summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.cpp
diff options
context:
space:
mode:
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();
}