From: vsv Date: Tue, 16 Oct 2018 12:32:00 +0000 (+0300) Subject: Issue #2690: Full update tree on deletion of a folder X-Git-Tag: V9_2_0a2~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=deeef3297f0914337a4d78c14b5b4dd7179f003c;p=modules%2Fshaper.git Issue #2690: Full update tree on deletion of a folder --- diff --git a/src/ModuleBase/ModuleBase_ITreeNode.h b/src/ModuleBase/ModuleBase_ITreeNode.h index c188dd97e..cef49758a 100644 --- a/src/ModuleBase/ModuleBase_ITreeNode.h +++ b/src/ModuleBase/ModuleBase_ITreeNode.h @@ -185,12 +185,13 @@ protected: int aIdx; int aCount = 0; int aSize = myChildren.size(); + int aShift = 0; while (i < aSize) { aCount++; aNode = myChildren.at(i); aObject = aNode->object(); if (aObject.get()) { - aIdx = aObject->document()->index(aObject, true); + aIdx = aObject->document()->index(aObject, true) + aShift; if (aIdx != i) { myChildren.removeAll(aNode); myChildren.insert(aIdx, aNode); @@ -198,6 +199,8 @@ protected: continue; } } + else + aShift++; i++; // To avoid unlimited cycling if (aCount > aSize * aSize) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 45354a917..4ead852d1 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -88,8 +88,14 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess const std::list, std::string>>& aMsgGroups = aUpdMsg->groups(); std::list, std::string>>::const_iterator aIt; - for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) + bool isRebuildTree = false; + for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) { + if (aIt->second == ModelAPI_Folder::group()) + isRebuildTree = true; QTreeNodesList aList = myRoot->objectsDeleted(aIt->first, aIt->second.c_str()); + } + if (isRebuildTree) + myRoot->update(); rebuildDataTree(); } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {