summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2012-10-06 11:02:42 +0200
committerArno <am@disconnect.de>2012-10-06 11:02:42 +0200
commite2d4843586d84da62e325d1cb0025a795b162c1c (patch)
tree9dd94bf487c4f1d55845854706387512d7279ea2 /mappingtreemodel.h
parentc7caac3459461f93fbae544a501fa491f84e5ce4 (diff)
downloadSheMov-e2d4843586d84da62e325d1cb0025a795b162c1c.tar.gz
SheMov-e2d4843586d84da62e325d1cb0025a795b162c1c.tar.bz2
SheMov-e2d4843586d84da62e325d1cb0025a795b162c1c.zip
More fixes to MappingTreeModel
Fix move, addChild and such. Rename Fields and Roles to more speaking names, but that revealed a much deeper bug: the ParentID isn't really the parent_id, but the mapping_id. That could explain a lot. Nevertheless, it's still faster to repopulate the model after moving oder adding children instead of calling removeRows and insertRows. Another non-working commit... :(
Diffstat (limited to 'mappingtreemodel.h')
-rw-r--r--mappingtreemodel.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/mappingtreemodel.h b/mappingtreemodel.h
index b2fa9eb..beb7d7f 100644
--- a/mappingtreemodel.h
+++ b/mappingtreemodel.h
@@ -21,8 +21,8 @@ class SmTreeItem;
class MappingTreeModel : public SmTreeModel {
Q_OBJECT
public:
- enum Roles { NameRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2, AddedRole = Qt::UserRole + 3, MapParentIdRole = Qt::UserRole + 4 };
- enum Fields { Name = 0, Id = 1, Added = 2, MapParentId = 3 };
+ enum Roles { NameRole = Qt::UserRole + 1, ParentIdRole = Qt::UserRole + 2, AddedRole = Qt::UserRole + 3, MyIdRole = Qt::UserRole + 4 };
+ enum Fields { Name = 0, ParentId = 1, Added = 2, MyId = 3 };
enum { NumFields = 4 };
MappingTreeModel(QStringList &headers, QObject *parent = 0);
~MappingTreeModel();
@@ -41,7 +41,7 @@ class MappingTreeModel : public SmTreeModel {
QStringList path(QModelIndex &idx) const;
QModelIndex indexFromPath(const QString &path, int column = 0) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
- void move(const QModelIndex &source, const QModelIndex &dest);
+ bool move(const QModelIndex &source, const QModelIndex &dest);
bool addMappingType(const QString &type);
bool deleteMappingType(int typeId);
bool addChild(const QVariant &name, const QModelIndex &parent);