From: nds Date: Tue, 24 May 2016 12:40:31 +0000 (+0300) Subject: Issue #1015: The validate icon must be greyed and inactive instead of red and active X-Git-Tag: V_2.3.1~63 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=23e61bd087e2e9d657a37ce1932b93b63dbfc08e;p=modules%2Fshaper.git Issue #1015: The validate icon must be greyed and inactive instead of red and active Popup menu actions upper parent should be the main application to have visible status tip information in status bar --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index f4f4be128..c52b6c62b 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -143,14 +144,14 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen //this->setLayout(aMainLay); connect(myTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectionTypeChanged())); - myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"), this, - this, SLOT(onCopyItem())); + myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"), + myWorkshop->desktop(), this, SLOT(onCopyItem())); myCopyAction->setShortcut(QKeySequence::Copy); myCopyAction->setEnabled(false); myListControl->addAction(myCopyAction); - myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"), this, - this, SLOT(onDeleteItem())); + myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"), + myWorkshop->desktop(), this, SLOT(onDeleteItem())); myDeleteAction->setEnabled(false); myListControl->addAction(myDeleteAction); diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 4dea8c2f1..7b60d802c 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -73,20 +74,21 @@ void PartSet_MenuMgr::createActions() { QAction* aAction; - aAction = ModuleBase_Tools::createAction(QIcon(), tr("Auxiliary"), this); + QWidget* aParent = myModule->workshop()->desktop(); + aAction = ModuleBase_Tools::createAction(QIcon(), tr("Auxiliary"), aParent); aAction->setCheckable(true); addAction("AUXILIARY_CMD", aAction); - aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), this, + aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), aParent, this, SLOT(onActivatePart(bool))); myActions["ACTIVATE_PART_CMD"] = aAction; // Activate PartSet - aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), this, + aAction = ModuleBase_Tools::createAction(QIcon(":icons/activate.png"), tr("Activate"), aParent, this, SLOT(onActivatePartSet(bool))); myActions["ACTIVATE_PARTSET_CMD"] = aAction; - aAction = ModuleBase_Tools::createAction(QIcon(":icons/edit.png"), tr("Edit..."), this, + aAction = ModuleBase_Tools::createAction(QIcon(":icons/edit.png"), tr("Edit..."), aParent, this, SLOT(onEdit(bool))); myActions["EDIT_CMD"] = aAction; } diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index 70a274c8e..0435be1a6 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -24,6 +24,7 @@ #include +#include #ifdef _DEBUG #include @@ -218,26 +219,27 @@ void XGUI_ActionsMgr::processEvent(const std::shared_ptr& theMes } } -QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId, QObject* theParent) +QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId) { QAction* aResult = NULL; if (myOperationActions.contains(theId)) { aResult = myOperationActions.value(theId); - if (theParent && aResult->parent() != theParent) { - aResult->setParent(theParent); - } + //if (theParent && aResult->parent() != theParent) { + // aResult->setParent(theParent); + //} } else { + QWidget* aParent = myWorkshop->desktop(); switch (theId) { case Accept: case AcceptAll: { aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok.png"), - "" /*empty to show error*/, theParent); + "Apply" /*empty to show error*/, aParent); } break; case Abort: case AbortAll: { aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_cancel.png"), "Cancel", - theParent); + aParent); if (theId == Abort) { aResult->setShortcut(QKeySequence(Qt::Key_Escape)); } @@ -245,11 +247,11 @@ QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId, QOb break; case Help: { aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_help.png"), "Help", - theParent); + aParent); } break; case Preview: { - aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), theParent, 0, 0, "Compute preview"); + aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), aParent, 0, 0, "Compute preview"); aResult->setStatusTip(aResult->toolTip()); } break; diff --git a/src/XGUI/XGUI_ActionsMgr.h b/src/XGUI/XGUI_ActionsMgr.h index f1f4e80ca..ab650ed8d 100644 --- a/src/XGUI/XGUI_ActionsMgr.h +++ b/src/XGUI/XGUI_ActionsMgr.h @@ -79,7 +79,7 @@ class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener //! Return property panel's action like ok, cancel, help. //! If there is no such action, it will be created. - QAction* operationStateAction(OperationStateActionId theId, QObject* theParent = 0); + QAction* operationStateAction(OperationStateActionId theId); /// Return an action by the given id, if it was registered in the manager QAction* action(const QString& theId); diff --git a/src/XGUI/XGUI_ErrorMgr.cpp b/src/XGUI/XGUI_ErrorMgr.cpp index 72a3bc975..79a7c1ae0 100644 --- a/src/XGUI/XGUI_ErrorMgr.cpp +++ b/src/XGUI/XGUI_ErrorMgr.cpp @@ -45,7 +45,7 @@ XGUI_ErrorMgr::XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorksh { ModuleBase_ModelWidget* anActiveWidget = activeWidget(); XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); - QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL); + QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); myAcceptAllToolTip = anAcceptAllAction->toolTip(); QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); @@ -102,7 +102,7 @@ void XGUI_ErrorMgr::updateAcceptAllAction(const FeaturePtr& theFeature) } XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); if (workshop()->isFeatureOfNested(theFeature)) { - QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL); + QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); bool anEnabled = anError.isEmpty(); anAcceptAllAction->setEnabled(anEnabled); anAcceptAllAction->setToolTip(!anEnabled ? anError : myAcceptAllToolTip); diff --git a/src/XGUI/XGUI_MenuMgr.cpp b/src/XGUI/XGUI_MenuMgr.cpp index 57acc07cb..4e1dedeff 100755 --- a/src/XGUI/XGUI_MenuMgr.cpp +++ b/src/XGUI/XGUI_MenuMgr.cpp @@ -78,12 +78,12 @@ void XGUI_MenuMgr::addFeature(const std::shared_ptr& theM XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr(); if (aNestedActions.contains(FEATURE_WHEN_NESTED_ACCEPT)) { - QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL); + QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(commitAllOperations())); aNestedActList << anAction; } if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) { - QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll, NULL); + QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(abortAllOperations())); aNestedActList << anAction; } @@ -186,12 +186,12 @@ QAction* XGUI_MenuMgr::buildAction(const std::shared_ptr& XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr(); if (aNestedActions.contains(FEATURE_WHEN_NESTED_ACCEPT)) { - QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL); + QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(commitAllOperations())); aNestedActList << anAction; } if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) { - QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll, NULL); + QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll); QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(abortAllOperations())); aNestedActList << anAction; }