From b49b1fa2a1733e2a681226484a91e18237e36eae Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 21 Apr 2017 16:00:12 +0300 Subject: [PATCH] Issue #2136: Update tree view on activation of a part --- src/PartSet/PartSet_Module.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index a9905b884..717bfeed6 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1244,10 +1244,15 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess DocumentPtr aActiveDoc = aMgr->activeDocument(); if (myActivePartIndex.isValid()) aTreeView->setExpanded(myActivePartIndex, false); + XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel(); myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc); - if (myActivePartIndex.isValid()) - aTreeView->setExpanded(myActivePartIndex, true); + bool needUpdate = false; + if (myActivePartIndex.isValid()) { + needUpdate = aTreeView->isExpanded(myActivePartIndex); + if (!needUpdate) + aTreeView->setExpanded(myActivePartIndex, true); + } aLabel->setPalette(aPalet); aWorkshop->updateCommandStatus(); @@ -1263,6 +1268,10 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess aDisplayer->redisplay(aObj, false); } aDisplayer->updateViewer(); + // Update tree items if they are expanded + if (needUpdate) { + aTreeView->viewport()->repaint(aTreeView->viewport()->rect()); + } } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); -- 2.39.2