diff options
author | Arno <am@disconnect.de> | 2012-10-06 11:02:42 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-10-06 11:02:42 +0200 |
commit | e2d4843586d84da62e325d1cb0025a795b162c1c (patch) | |
tree | 9dd94bf487c4f1d55845854706387512d7279ea2 /picfilesmodel.cpp | |
parent | c7caac3459461f93fbae544a501fa491f84e5ce4 (diff) | |
download | SheMov-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 'picfilesmodel.cpp')
-rw-r--r-- | picfilesmodel.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/picfilesmodel.cpp b/picfilesmodel.cpp index 651ce32..cab7235 100644 --- a/picfilesmodel.cpp +++ b/picfilesmodel.cpp @@ -40,7 +40,7 @@ PicFilesModel::~PicFilesModel(){ } void PicFilesModel::setMapping(int pMapId){ - QList<QVariant> ids = mMappingTreeModel->childList(pMapId, MappingTreeModel::MapParentId); + QList<QVariant> ids = mMappingTreeModel->childList(pMapId, MappingTreeModel::MyId); mMappingIds.clear(); foreach(QVariant i, ids){ mMappingIds << i.toInt(); @@ -170,9 +170,9 @@ QList<MappingData> PicFilesModel::mappingDataFromFiles(const QList<int> fileIds) } QList<MappingData> retval; foreach(int pId, parentIds){ - QModelIndex curIdx = mMappingTreeModel->findRecursive(pId, MappingTreeModel::MapParentId, mMappingTreeModel->rootIndex()); + QModelIndex curIdx = mMappingTreeModel->findRecursive(pId, MappingTreeModel::MyId, mMappingTreeModel->rootIndex()); MappingData curData; - curData.id = curIdx.data(MappingTreeModel::MapParentIdRole).toInt(); + curData.id = curIdx.data(MappingTreeModel::MyIdRole).toInt(); curData.name = curIdx.data(MappingTreeModel::NameRole).toString(); curData.path << mMappingTreeModel->path(curIdx); //.join("/"); retval << curData; |