From: vsv Date: Thu, 10 Sep 2015 15:28:18 +0000 (+0300) Subject: Issue #663: Don't hide "Activate" menu item in PartSet pop-up X-Git-Tag: V_1.4.0_beta4~31^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7d182041b78ddb4375098cff6042edc8817f540c;p=modules%2Fshaper.git Issue #663: Don't hide "Activate" menu item in PartSet pop-up --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index adb46118f..1abaeb6b0 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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& theMessage)