]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Optimize updating of the tree
authorvsv <vsv@opencascade.com>
Wed, 21 Nov 2018 14:25:33 +0000 (17:25 +0300)
committervsv <vsv@opencascade.com>
Wed, 21 Nov 2018 14:25:33 +0000 (17:25 +0300)
src/XGUI/XGUI_DataModel.cpp

index 4980dd1984693bd1441f7e6f2944a5bc91f2eaa9..4e29b27236522f0440f651c240b62c9731afc5a6 100644 (file)
@@ -139,20 +139,20 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
       rebuildDataTree();
     }
     else {
+      QTreeNodesList aParents;
       foreach(ObjectPtr aObj, aCreated) {
         ModuleBase_ITreeNode* aNode = myRoot->subNode(aObj);
         if (aNode) {
           if (aNode->parent())
-            aNode->parent()->update();
-          else
-            aNode->update();
-          rebuildDataTree();
-          QModelIndex aFirstIdx = getIndex(aNode, 0);
-          QModelIndex aLastIdx = getIndex(aNode, 2);
-
-          dataChanged(aFirstIdx, aLastIdx);
+            aNode = aNode->parent();
+          if (!aParents.contains(aNode))
+            aParents.append(aNode);
         }
       }
+      foreach(ModuleBase_ITreeNode* aNode, aParents) {
+        aNode->update();
+      }
+      rebuildDataTree();
     }
   }
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_ORDER_UPDATED)) {