]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2678: Manage history line for part roots
authorvsv <vsv@opencascade.com>
Mon, 8 Oct 2018 10:11:03 +0000 (13:11 +0300)
committervsv <vsv@opencascade.com>
Mon, 8 Oct 2018 10:11:03 +0000 (13:11 +0300)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_TreeNodes.cpp

index 4eef01a5fb328bf9ccfa1178412aa619178909da..51b970981757e15022b4828fe4fedd498a726930 100755 (executable)
@@ -1447,6 +1447,7 @@ void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& 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<Events_Message>& theMess
       if (!needUpdate)
         aTreeView->setExpanded(myActivePartIndex, true);
     }
+    if ((aOldActive != myActivePartIndex) && (aOldActive.isValid()))
+      aTreeView->setExpanded(aOldActive, false);
 
     aLabel->setPalette(aPalet);
     aWorkshop->updateCommandStatus();
index aab74ef42ea5606f29b518bff80c1f5d58f51a6c..a4381a3f7109fea49c47afccc1b31a7cef192b2d 100644 (file)
@@ -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))