]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1015: The validate icon must be greyed and inactive instead of red and active
authornds <nds@opencascade.com>
Tue, 24 May 2016 12:40:31 +0000 (15:40 +0300)
committernds <nds@opencascade.com>
Tue, 24 May 2016 12:40:54 +0000 (15:40 +0300)
Popup menu actions upper parent should be the main application to have visible status tip information in status bar

src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/PartSet/PartSet_MenuMgr.cpp
src/XGUI/XGUI_ActionsMgr.cpp
src/XGUI/XGUI_ActionsMgr.h
src/XGUI/XGUI_ErrorMgr.cpp
src/XGUI/XGUI_MenuMgr.cpp

index f4f4be12857a5012b21303e22be856d915062ca6..c52b6c62b48b74fea103ffa239a0dd663723b728 100755 (executable)
@@ -38,6 +38,7 @@
 #include <QApplication>
 #include <QClipboard>
 #include <QTimer>
+#include <QMainWindow>
 
 #include <memory>
 #include <string>
@@ -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);
 
index 4dea8c2f1b32dbd1cf85a85e4ae93ace0bd37e39..7b60d802cd274cf7027b32a926c5908a1c17f39b 100644 (file)
@@ -39,6 +39,7 @@
 #include <ModelAPI_ResultPart.h>
 #include <ModelAPI_ResultParameter.h>
 
+#include <QMainWindow>
 #include <QAction>
 #include <QMenu>
 #include <QEvent>
@@ -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;
 }
index 70a274c8e06d85b4842664f231b2aa50c2ccf92d..0435be1a6cafbf1aa7c3057f56aae249aef6c0c2 100644 (file)
@@ -24,6 +24,7 @@
 
 
 #include <QAction>
+#include <QMainWindow>
 
 #ifdef _DEBUG
 #include <iostream>
@@ -218,26 +219,27 @@ void XGUI_ActionsMgr::processEvent(const std::shared_ptr<Events_Message>& 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;
index f1f4e80ca571c2203b6264128d33b71a33a9c3a3..ab650ed8dd3fcec6e2b1e4fabe07cab9adb978f5 100644 (file)
@@ -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);
index 72a3bc97526c2dbcd5952be8bc2386a43a09c6bf..79a7c1ae0a27983326f7bb640b466b0b8789f390 100644 (file)
@@ -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);
index 57acc07cb430bb4665e309232a720b47b2bb9018..4e1dedeffc1eccdcf51ce120ba6bd5411264e630 100755 (executable)
@@ -78,12 +78,12 @@ void XGUI_MenuMgr::addFeature(const std::shared_ptr<Config_FeatureMessage>& 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<Config_FeatureMessage>&
     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;
     }