From: vsv Date: Wed, 21 Nov 2018 14:25:33 +0000 (+0300) Subject: Optimize updating of the tree X-Git-Tag: End2018~156 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5cbac39558de17b7a1abda19e86f3f7625b9779e;p=modules%2Fshaper.git Optimize updating of the tree --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 4980dd198..4e29b2723 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -139,20 +139,20 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& 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)) {