From: vsv Date: Fri, 21 Apr 2017 13:00:12 +0000 (+0300) Subject: Issue #2136: Update tree view on activation of a part X-Git-Tag: V_2.7.1~48 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b49b1fa2a1733e2a681226484a91e18237e36eae;p=modules%2Fshaper.git Issue #2136: Update tree view on activation of a part --- 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);