From 577232d8f9496ffc862329c42ffbc9d09e742be8 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 22 Nov 2018 09:53:02 +0300 Subject: [PATCH] Optimization of folders update in a data tree --- src/XGUI/XGUI_DataModel.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index fc6096e86..a574c0353 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -143,10 +143,17 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess foreach(ObjectPtr aObj, aCreated) { ModuleBase_ITreeNode* aNode = myRoot->subNode(aObj); if (aNode) { - if (aNode->parent()) - aNode = aNode->parent(); - if (!aParents.contains(aNode)) - aParents.insert(aNode); + if (aNode->parent()) { + if (aNode->parent() == myRoot) { + aParents.clear(); + aParents.insert(myRoot); + break; + } + else { + aNode = aNode->parent(); + } + } + aParents.insert(aNode); } } foreach(ModuleBase_ITreeNode* aNode, aParents) { -- 2.39.2