summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2012-02-25 16:52:48 +0100
committerArno <am@disconnect.de>2012-02-25 16:52:48 +0100
commit67ddb23a59cb56bd917db2d9c3c7bc62c96e53b4 (patch)
tree50282f53691db30c8fd2999c299d24ef859b11f3 /mappingtreemodel.h
parentdce686c895fce27cce1d8bf0247c692bd790f93a (diff)
downloadSheMov-67ddb23a59cb56bd917db2d9c3c7bc62c96e53b4.tar.gz
SheMov-67ddb23a59cb56bd917db2d9c3c7bc62c96e53b4.tar.bz2
SheMov-67ddb23a59cb56bd917db2d9c3c7bc62c96e53b4.zip
Implemented mapping widget for NewPicsDialog
Make it possible to add mappings to new pictures. This actually was a tough one. Maybe I shouldn't drink and code. Next: make NewPicsDialog actually do something.
Diffstat (limited to 'mappingtreemodel.h')
-rw-r--r--mappingtreemodel.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/mappingtreemodel.h b/mappingtreemodel.h
index 451ab83..a37e364 100644
--- a/mappingtreemodel.h
+++ b/mappingtreemodel.h
@@ -14,6 +14,8 @@
class QSqlQuery;
class SmTreeItem;
+class MappingData;
+class SmTreeItem;
class MappingTreeModel : public SmTreeModel {
Q_OBJECT
@@ -69,4 +71,31 @@ class MappingTreeModel : public SmTreeModel {
};
+class MappingTreeResultModel : public SmTreeModel {
+ Q_OBJECT
+ public:
+ enum Roles { NameRole = Qt::UserRole + 1 };
+ enum Fields { Name = 0 };
+ enum { NumFields = 1 };
+ explicit MappingTreeResultModel(const QStringList &headers, QObject *parent = 0);
+
+ //data + flags
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role);
+ QModelIndex insertChild(const QVariant &data, SmTreeItem *parent);
+
+ public slots:
+ void addItem(const MappingData &data);
+
+
+ private:
+ int hasChild(SmTreeItem *item, const QVariant &name, int column = 0) const;
+};
+
+struct MappingData {
+ int id;
+ QString name;
+ QStringList path;
+};
+
#endif // MAPPINGTREEMODEL_H