]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2690: Optimize deletion of tree update
authorvsv <vsv@opencascade.com>
Tue, 16 Oct 2018 12:45:46 +0000 (15:45 +0300)
committervsv <vsv@opencascade.com>
Tue, 16 Oct 2018 12:45:46 +0000 (15:45 +0300)
src/XGUI/XGUI_DataModel.cpp

index 4ead852d1f57abf8763d666650c7ab24da804529..ee7f934575be45e96d283c0059cd48470785725e 100644 (file)
@@ -87,15 +87,15 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
       std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
     const std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string>>& aMsgGroups =
       aUpdMsg->groups();
+    QTreeNodesList aList;
     std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string>>::const_iterator 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());
+      aList.append(myRoot->objectsDeleted(aIt->first, aIt->second.c_str()));
+    }
+    foreach(ModuleBase_ITreeNode* aNode, aList) {
+      if (aNode->parent())
+        aNode->parent()->update();
     }
-    if (isRebuildTree)
-      myRoot->update();
     rebuildDataTree();
   }
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {