From 2defc44300bd18917e6e5e2327ebb72f951ff7b1 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 17 Nov 2012 05:14:56 +0100 Subject: Finally { fix MappingTreeModel }!!! I think I did it! Fixed MappingTreeModel to make it usable, avoid all the traps with the insane column and variable names! Now we can actually have the same mapping with different parents! Yay! Hope it won't come back and bite me! --- picfilesmodel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'picfilesmodel.cpp') diff --git a/picfilesmodel.cpp b/picfilesmodel.cpp index 4114eb5..6b8153f 100644 --- a/picfilesmodel.cpp +++ b/picfilesmodel.cpp @@ -40,7 +40,7 @@ PicFilesModel::~PicFilesModel(){ } void PicFilesModel::setMapping(int pMapId){ - QList ids = mMappingTreeModel->childList(pMapId, MappingTreeModel::DescId); + QList ids = mMappingTreeModel->childList(pMapId, MappingTreeModel::MappingId); mMappingIds.clear(); foreach(QVariant i, ids){ mMappingIds << i.toInt(); @@ -170,13 +170,12 @@ QList PicFilesModel::mappingDataFromFiles(const QList fileIds) } QList retval; foreach(int pId, parentIds){ - QModelIndex curIdx = mMappingTreeModel->findRecursive(pId, MappingTreeModel::DescId, mMappingTreeModel->rootIndex()); + QModelIndex curIdx = mMappingTreeModel->findRecursive(pId, MappingTreeModel::MappingId, mMappingTreeModel->rootIndex()); MappingData curData; - //curData.id = curIdx.data(MappingTreeModel::MyIdRole).toInt(); curData.mappingId = curIdx.data(MappingTreeModel::MappingIdRole).toInt(); curData.parentId = curIdx.data(MappingTreeModel::MappingParentIdRole).toInt(); curData.name = curIdx.data(MappingTreeModel::NameRole).toString(); - curData.path << mMappingTreeModel->path(curIdx); //.join("/"); + curData.path << mMappingTreeModel->path(curIdx); retval << curData; } return retval; -- cgit v1.2.3-70-g09d2