diff options
author | Arno <am@disconnect.de> | 2012-10-27 13:02:16 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-10-27 13:02:16 +0200 |
commit | dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e (patch) | |
tree | 30de1f390ad33f067ba1cb9872f994df620fd8c6 /mappingtreemodel.h | |
parent | a4054f1c7b38e5996081efd7583c06ebf7758e61 (diff) | |
download | SheMov-dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e.tar.gz SheMov-dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e.tar.bz2 SheMov-dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e.zip |
Fix archiving pictures
Well, what can I say. Lost in recursion and parent pointers. This commit
actually boils down to using the proper database tables and inserting
the right values. 'Nuff said...
Diffstat (limited to 'mappingtreemodel.h')
-rw-r--r-- | mappingtreemodel.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mappingtreemodel.h b/mappingtreemodel.h index 38c0c7b..a4a1ae8 100644 --- a/mappingtreemodel.h +++ b/mappingtreemodel.h @@ -96,16 +96,16 @@ class MappingTreeModel : public SmTreeModel { class MappingTreeResultModel : public SmTreeModel { Q_OBJECT public: - enum Roles { NameRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2 }; - enum Fields { Name = 0, Id = 1 }; - enum { NumFields = 2 }; + enum Roles { NameRole = Qt::UserRole + 1, MappingIdRole = Qt::UserRole + 2, ParentIdRole = Qt::UserRole + 3, MyIdRole = Qt::UserRole + 4 }; + enum Fields { Name = 0, MappingId = 1, ParentId = 2, MyId = 3 }; + enum { NumFields = 4 }; 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, int id, SmTreeItem *parent); - QList<int> mappingsIds() const; + QModelIndex insertChild(const QVariant &data, int mappingId, int parentId, int myId, SmTreeItem *parent); + QList<QVariant> columnValues(int column) const; void clearData(); public slots: @@ -113,11 +113,13 @@ class MappingTreeResultModel : public SmTreeModel { private: int hasChild(SmTreeItem *item, const QVariant &name, int column = 0) const; - QList<int> mappingIdsRecursive(SmTreeItem *parent) const; + QList<QVariant> columnValuesRecursive(SmTreeItem *parent, int column) const; }; struct MappingData { - int id; + int mappingId; + int parentId; + int myId; QString name; QList<QStringList> path; }; |