From 4b14105bd502f8e06d50cff67a4775647983500c Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 16 Oct 2018 15:45:46 +0300 Subject: [PATCH] Issue #2690: Optimize deletion of tree update --- src/XGUI/XGUI_DataModel.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 4ead852d1..ee7f93457 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -87,15 +87,15 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess std::dynamic_pointer_cast(theMessage); const std::list, std::string>>& aMsgGroups = aUpdMsg->groups(); + QTreeNodesList aList; std::list, 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)) { -- 2.39.2