From: vsv Date: Mon, 8 Oct 2018 10:11:03 +0000 (+0300) Subject: Issue #2678: Manage history line for part roots X-Git-Tag: V9_2_0a2~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=012b1e2f2f064611ca57c5cc80965ee0674476e9;p=modules%2Fshaper.git Issue #2678: Manage history line for part roots --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 4eef01a5f..51b970981 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1447,6 +1447,7 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess // aTreeView->setExpanded(myActivePartIndex, false); XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel(); + QModelIndex aOldActive = myActivePartIndex; myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc, 0); bool needUpdate = false; if (myActivePartIndex.isValid()) { @@ -1454,6 +1455,8 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess if (!needUpdate) aTreeView->setExpanded(myActivePartIndex, true); } + if ((aOldActive != myActivePartIndex) && (aOldActive.isValid())) + aTreeView->setExpanded(aOldActive, false); aLabel->setPalette(aPalet); aWorkshop->updateCommandStatus(); diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index aab74ef42..a4381a3f7 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -128,6 +128,8 @@ QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const case 2: if (isCurrentFeature(myObject)) return QIcon(":pictures/arrow.png"); + else + return QIcon(); } } return PartSet_TreeNode::data(theColumn, theRole); @@ -442,6 +444,10 @@ QVariant PartSet_FolderNode::data(int theColumn, int theRole) const } if ((theColumn == 2) && (theRole == Qt::DecorationRole)) { if (document().get()) { + SessionPtr aSession = ModelAPI_Session::get(); + if (document() != aSession->activeDocument()) + return QIcon(); + FeaturePtr aFeature = document()->currentFeature(true); if (!aFeature.get()) { // There is no current feature ModuleBase_ITreeNode* aLastFolder = 0; @@ -453,6 +459,8 @@ QVariant PartSet_FolderNode::data(int theColumn, int theRole) const } if (aLastFolder == this) return QIcon(":pictures/arrow.png"); + else + return QIcon(); } } } @@ -926,12 +934,22 @@ QVariant PartSet_PartRootNode::data(int theColumn, int theRole) const case Qt::DecorationRole: return ModuleBase_IconFactory::get()->getIcon(myObject); } + case 2: + if (theRole == Qt::DecorationRole) { + if (isCurrentFeature(myObject)) + return QIcon(":pictures/arrow.png"); + else + return QIcon(); + } } return PartSet_TreeNode::data(theColumn, theRole); } Qt::ItemFlags PartSet_PartRootNode::flags(int theColumn) const { + if (myObject->isDisabled()) + return (theColumn == 2) ? Qt::ItemIsSelectable : aNullFlag; + SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aActiveDoc = aSession->activeDocument(); if ((aActiveDoc == document()) || (myObject->document() == aActiveDoc))