From: nds Date: Wed, 25 May 2016 06:53:59 +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~60 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=59cc5c4904f912cb5d28581f850facc9621e0652;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/XGUI/XGUI_ErrorMgr.cpp b/src/XGUI/XGUI_ErrorMgr.cpp index 84b2c90a5..b2a1a87f9 100644 --- a/src/XGUI/XGUI_ErrorMgr.cpp +++ b/src/XGUI/XGUI_ErrorMgr.cpp @@ -41,17 +41,12 @@ XGUI_ErrorMgr::XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorksh : ModuleBase_IErrorMgr(theParent), myErrorDialog(0), myErrorLabel(0), - myWorkshop(theWorkshop) + myWorkshop(theWorkshop), + myAcceptAllToolTip(""), + myAcceptAllStatusTip(""), + myAcceptToolTip(""), + myAcceptStatusTip("") { - ModuleBase_ModelWidget* anActiveWidget = activeWidget(); - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); - QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); - myAcceptAllToolTip = anAcceptAllAction->toolTip(); - myAcceptAllStatusTip = anAcceptAllAction->statusTip(); - - QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); - myAcceptToolTip = anOkAction->toolTip(); - myAcceptStatusTip = anOkAction->toolTip(); } XGUI_ErrorMgr::~XGUI_ErrorMgr() @@ -96,6 +91,9 @@ void XGUI_ErrorMgr::updateActions(const FeaturePtr& theFeature) void XGUI_ErrorMgr::updateAcceptAllAction(const FeaturePtr& theFeature) { + if (myAcceptAllToolTip.isEmpty() && myAcceptToolTip.isEmpty()) + storeInitialActionValues(); + QString anError = myWorkshop->module()->getFeatureError(theFeature); if (anError.isEmpty()) { ModuleBase_ModelWidget* anActiveWidget = activeWidget(); @@ -125,13 +123,28 @@ bool XGUI_ErrorMgr::isApplyEnabled() const return isEnabled; } +void XGUI_ErrorMgr::storeInitialActionValues() +{ + ModuleBase_ModelWidget* anActiveWidget = activeWidget(); + XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); + QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); + myAcceptAllToolTip = anAcceptAllAction->toolTip(); + myAcceptAllStatusTip = anAcceptAllAction->statusTip(); + + QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); + myAcceptToolTip = anOkAction->toolTip(); + myAcceptStatusTip = anOkAction->toolTip(); +} + void XGUI_ErrorMgr::updateAcceptActionState(const QString& theError) { XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); QAction* anAcceptAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); - bool anEnabled = theError.isEmpty(); + if (myAcceptAllToolTip.isEmpty() && myAcceptToolTip.isEmpty()) + storeInitialActionValues(); + bool anEnabled = theError.isEmpty(); anAcceptAction->setEnabled(anEnabled); anAcceptAction->setToolTip(anEnabled ? myAcceptToolTip : theError); anAcceptAction->setStatusTip(anEnabled ? myAcceptStatusTip : theError); diff --git a/src/XGUI/XGUI_ErrorMgr.h b/src/XGUI/XGUI_ErrorMgr.h index b37b8ecac..3a320c4b0 100644 --- a/src/XGUI/XGUI_ErrorMgr.h +++ b/src/XGUI/XGUI_ErrorMgr.h @@ -52,6 +52,9 @@ protected slots: virtual void onWidgetChanged(); private: + /// Stores initial values of accept/accept all tool/status tip to internal containers + void storeInitialActionValues(); + /// It disables the propety panel Accept action if the error message is not empty /// The message is set to the header tool tip. /// \param theAction an action to be changed