summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2016-03-30 06:07:22 +0200
committerArno <arno@disconnect.de>2016-03-30 06:07:22 +0200
commit2e4e94a52824d2f85af739644461fdc184aed93d (patch)
tree1a76defe963bd3fe11df836d45f9523257ed5599 /mappingtreemodel.cpp
parent9f6d01e50f1f1d31e59fc407c852e4c69090d3b0 (diff)
downloadSheMov-2e4e94a52824d2f85af739644461fdc184aed93d.tar.gz
SheMov-2e4e94a52824d2f85af739644461fdc184aed93d.tar.bz2
SheMov-2e4e94a52824d2f85af739644461fdc184aed93d.zip
Save mappings from slide dialog
Also fix a long standing bug in MappingTreeModel: also remove item from mCurrentData when the removed item is a parent of one of the items.
Diffstat (limited to 'mappingtreemodel.cpp')
-rw-r--r--mappingtreemodel.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp
index 78e4802..2cf4445 100644
--- a/mappingtreemodel.cpp
+++ b/mappingtreemodel.cpp
@@ -484,7 +484,20 @@ void MappingTreeResultModel::removeItem(const QModelIndex &idx){
int row = curItem->row();
SmTreeItem *parent = curItem->parent();
parent->removeChild(row);
- mCurrentData.removeAll(rmData);
+ int count = mCurrentData.removeAll(rmData);
+ int toRemove = -1;
+ if(count == 0){
+ for(int i = 0; i < mCurrentData.count(); ++i){
+ MappingData cur = mCurrentData.at(i);
+ if(cur.parents.contains(rmData.mappingId)){
+ toRemove = i;
+ break;
+ }
+ }
+ }
+ if(toRemove > -1 && toRemove < mCurrentData.count()){
+ mCurrentData.removeAt(toRemove);
+ }
endResetModel();
}