]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #663: Don't hide "Activate" menu item in PartSet pop-up
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 10 Sep 2015 15:28:18 +0000 (18:28 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 10 Sep 2015 15:28:31 +0000 (18:28 +0300)
src/PartSet/PartSet_Module.cpp

index adb46118fc10a3c752e3479c85f321c1fa2ff22f..1abaeb6b0377cbfce3498c0f103c8c3a964f06a7 100755 (executable)
@@ -880,6 +880,7 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
   int aSelected = aObjects.size();
   SessionPtr aMgr = ModelAPI_Session::get();
   QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
+  QAction* aActivatePartSetAction = myMenuMgr->action("ACTIVATE_PARTSET_CMD");
   if (aSelected == 1) {
     bool hasResult = false;
     bool hasFeature = false;
@@ -913,20 +914,21 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
       if( aResult.get() )
         theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
     } else {  // If feature is 0 the it means that selected root object (document)
-      if (aMgr->activeDocument() != aMgr->moduleDocument())
-        theMenu->addAction(myMenuMgr->action("ACTIVATE_PARTSET_CMD"));
+      theMenu->addAction(aActivatePartSetAction);
+      aActivatePartSetAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument()));
     }
   } else if (aSelected == 0) {
     // if there is no selection then it means that upper label is selected
     QModelIndexList aIndexes = myWorkshop->selection()->selectedIndexes();
     if (aIndexes.size() == 0) // it means that selection happens in top label outside of tree view
-      if (aMgr->activeDocument() != aMgr->moduleDocument())
-        theMenu->addAction(myMenuMgr->action("ACTIVATE_PARTSET_CMD"));
+      theMenu->addAction(aActivatePartSetAction);
+      aActivatePartSetAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument()));
   }
   bool aNotDeactivate = (myWorkshop->currentOperation() == 0);
-  myMenuMgr->action("ACTIVATE_PARTSET_CMD")->setEnabled(aNotDeactivate);
-  if (!aNotDeactivate)
+  if (!aNotDeactivate) {
     aActivatePartAction->setEnabled(false);
+    aActivatePartSetAction->setEnabled(false);
+  }
 }
 
 void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)