diff options
Diffstat (limited to 'mappingtreemodel.cpp')
-rw-r--r-- | mappingtreemodel.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp index fd5fbe3..b42bad3 100644 --- a/mappingtreemodel.cpp +++ b/mappingtreemodel.cpp @@ -117,11 +117,11 @@ QVariant MappingTreeModel::data(const QModelIndex &index, int role) const{ if(role == MappingIdRole){ return item->data(MappingId); } - if(role == AddedRole){ - return item->data(Added); + if(role == DescAddedRole){ + return item->data(DescAdded); } - if(role == MyIdRole){ - return item->data(MyId); + if(role == DescIdRole){ + return item->data(DescId); } if(role == ParentIdRole){ return item->data(ParentId); @@ -209,17 +209,17 @@ bool MappingTreeModel::setData(const QModelIndex &index, const QVariant &value, if(role == MappingIdRole){ item->setData(MappingId, value); } - if(role == AddedRole){ - item->setData(Added, value); + if(role == DescAddedRole){ + item->setData(DescAdded, value); } - if(role == MyIdRole){ - item->setData(MyId, value); + if(role == DescIdRole){ + item->setData(DescId, value); } return true; } bool MappingTreeModel::move(const QModelIndex &source, const QModelIndex &dest){ - QVariant sourceId = source.data(MyIdRole); + QVariant sourceId = source.data(DescIdRole); QVariant destId = dest.data(MappingIdRole); mDb.transaction(); mUpdateParentQ->bindValue(":id", destId); @@ -295,7 +295,7 @@ bool MappingTreeModel::deleteChild(const QModelIndex &idx){ if(item->childCount() > 0){ return false; } - mDeleteMappingParentQ->bindValue(":id", item->data(MyId)); + mDeleteMappingParentQ->bindValue(":id", item->data(DescId)); if(mDeleteMappingParentQ->exec()){ removeRows(idx.row(), 1, idx.parent()); return true; @@ -311,7 +311,7 @@ MappingData MappingTreeModel::mappingDataFromIndex(QModelIndex &idx) const{ } retval.mappingId = idx.data(MappingTreeModel::MappingIdRole).toInt(); retval.parentId = idx.data(MappingTreeModel::ParentIdRole).toInt(); - retval.myId = idx.data(MappingTreeModel::MyIdRole).toInt(); + retval.myId = idx.data(MappingTreeModel::DescIdRole).toInt(); retval.name = idx.data(MappingTreeModel::NameRole).toString(); retval.path << path(idx); return retval; @@ -334,7 +334,7 @@ void MappingTreeModel::populate(){ rootQ.bindValue(":pid", -1); if(rootQ.exec()){ SmTreeItem *rootItem = new SmTreeItem(NumFields); - rootItem->setData(MyId, -1); + rootItem->setData(DescId, -1); rootItem->setData(MappingId, -1); mSeen.clear(); while(rootQ.next()){ @@ -407,10 +407,10 @@ void MappingTreeModel::getChildrenRecursive(SmTreeItem *item){ while(cq.next()){ QList<QVariant> childData; childData << cq.value(2) << cq.value(1) << cq.value(3) << cq.value(0) << cq.value(4); - if(mSeen.contains(childData.at((MyId)))){ + if(mSeen.contains(childData.at((DescId)))){ return; } - mSeen << childData.at(MyId); + mSeen << childData.at(DescId); SmTreeItem *child = new SmTreeItem(childData, item); item->appendChild(child); getChildrenRecursive(child); |