]> 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 11:24:23 +0000 (14:24 +0300)
committernds <nds@opencascade.com>
Tue, 24 May 2016 11:24:49 +0000 (14:24 +0300)
Actions contain information for Status bar: SHAPER mode

src/ModuleBase/ModuleBase_ActionInfo.cpp
src/ModuleBase/ModuleBase_ActionInfo.h
src/XGUI/XGUI_ContextMenuMgr.cpp

index b9540f26dfd27cc7a5dc7d5e0f82541bd4504e8b..35721b3585ce359551e7bd3a763d156d38236799 100644 (file)
@@ -69,24 +69,6 @@ void ModuleBase_ActionInfo::initFrom(std::shared_ptr<Config_FeatureMessage> theM
   modal = theMessage->isModal();
 }
 
-QAction* ModuleBase_ActionInfo::makeAction(QObject* theParent)
-{
-  QAction* aResult = new QAction(icon, text, theParent);
-  aResult->setCheckable(checkable);
-  aResult->setChecked(checked);
-  aResult->setEnabled(enabled);
-  aResult->setVisible(visible);
-  aResult->setIconText(iconText);
-  aResult->setToolTip(toolTip);
-  aResult->setStatusTip(toolTip);
-  // aResult->setWhatsThis(whatsThis);
-  aResult->setShortcut(shortcut);
-  aResult->setFont(font);
-  // By convenience, QAction for a feature keeps feature's id as data (QVariant);
-  aResult->setData(id);
-  return aResult;
-}
-
 void ModuleBase_ActionInfo::initDefault()
 {
   id = QString();
index a726d137f2c9f0f14bae386ff007097bc016c174..1f21c7ca19be64ae95bf6f23d3141e992c554521 100644 (file)
@@ -52,9 +52,6 @@ struct MODULEBASE_EXPORT ModuleBase_ActionInfo
   void initFrom(QAction* theAction);
   //! Fills itself with info from given \param theFeatureMessage
   void initFrom(std::shared_ptr<Config_FeatureMessage> theFeatureMessage);
-  //! Creates new QAction with given parent and data initialized from this structure
-  //! \param theParent - parent of created action
-  QAction* makeAction(QObject* theParent = 0);
 
  protected:
   //! Initializes structure with default values, like QAction()
index 65fe3d596f5b85f35aeab8c556cd63009972cdf6..2afd9449591d5ebd3a05b0ab60af3fd9b0390ed1 100644 (file)
@@ -64,79 +64,82 @@ void XGUI_ContextMenuMgr::createActions()
   QMainWindow* aDesktop = myWorkshop->mainWindow();
 #endif
 
-  QAction* aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
+  QAction* aAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
   aDesktop->addAction(aAction);
 
   addAction("DELETE_CMD", aAction);
   aAction->setShortcutContext(Qt::ApplicationShortcut);
 
-  aAction = new QAction(QIcon(":pictures/rename_edit.png"), tr("Rename"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/rename_edit.png"), tr("Rename"), this,
+                        this, SLOT(onRename()));
   addAction("RENAME_CMD", aAction);
-  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRename()));
 
-  aAction = new QAction(QIcon(":pictures/move.png"), XGUI_Workshop::MOVE_TO_END_COMMAND, this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/move.png"),
+                                           XGUI_Workshop::MOVE_TO_END_COMMAND, this);
   addAction("MOVE_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/clean_history.png"), tr("Clean history"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/clean_history.png"), tr("Clean history"), this);
   addAction("CLEAN_HISTORY_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/color.png"), tr("Color..."), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/color.png"), tr("Color..."), this);
   addAction("COLOR_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), this);
   addAction("SHOW_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show only"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil.png"), tr("Show only"), this);
   addAction("SHOW_ONLY_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), this);
   addAction("HIDE_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide all"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide all"), this);
   addAction("HIDEALL_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/shading.png"), tr("Shading"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/shading.png"), tr("Shading"), this);
   addAction("SHADING_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/wireframe.png"), tr("Wireframe"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/wireframe.png"), tr("Wireframe"), this);
   addAction("WIREFRAME_CMD", aAction);
 
-  mySeparator = new QAction(this);
+  mySeparator = ModuleBase_Tools::createAction(QIcon(), "", this);
   mySeparator->setSeparator(true);
 
   //mySelectActions = new QActionGroup(this);
   //mySelectActions->setExclusive(true);
 
-  aAction = new QAction(QIcon(":pictures/vertex.png"), tr("Vertices"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/vertex.png"), tr("Vertices"), this,
+                                           this, SLOT(onShapeSelection(bool)));
   aAction->setCheckable(true);
   addAction("SELECT_VERTEX_CMD", aAction);
-  connect(aAction, SIGNAL(triggered(bool)), SLOT(onShapeSelection(bool)));
   //mySelectActions->addAction(aAction);
 
-  aAction = new QAction(QIcon(":pictures/edge.png"), tr("Edges"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/edge.png"), tr("Edges"), this,
+                                           this, SLOT(onShapeSelection(bool)));
   aAction->setCheckable(true);
   addAction("SELECT_EDGE_CMD", aAction);
-  connect(aAction, SIGNAL(triggered(bool)), SLOT(onShapeSelection(bool)));
   //mySelectActions->addAction(aAction);
 
-  aAction = new QAction(QIcon(":pictures/face.png"), tr("Faces"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/face.png"), tr("Faces"), this,
+                                           this, SLOT(onShapeSelection(bool)));
   aAction->setCheckable(true);
   addAction("SELECT_FACE_CMD", aAction);
-  connect(aAction, SIGNAL(triggered(bool)), SLOT(onShapeSelection(bool)));
   //mySelectActions->addAction(aAction);
 
-  aAction = new QAction(QIcon(":pictures/result.png"), tr("Result"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/result.png"), tr("Result"), this,
+                                           this, SLOT(onResultSelection(bool)));
   aAction->setCheckable(true);
   addAction("SELECT_RESULT_CMD", aAction);
-  connect(aAction, SIGNAL(triggered(bool)), SLOT(onResultSelection(bool)));
   //mySelectActions->addAction(aAction);
 
   aAction->setChecked(true);
 
-  aAction = new QAction(QIcon(":pictures/find_result.png"), tr("Select results"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/find_result.png"),
+                                           tr("Select results"), this);
   addAction("SHOW_RESULTS_CMD", aAction);
 
-  aAction = new QAction(QIcon(":pictures/find_result.png"), tr("Select parent feature"), this);
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/find_result.png"),
+                                           tr("Select parent feature"), this);
   addAction("SHOW_FEATURE_CMD", aAction);
 
   buildObjBrowserMenu();
@@ -417,7 +420,7 @@ void XGUI_ContextMenuMgr::connectViewer()
 
 void XGUI_ContextMenuMgr::buildObjBrowserMenu()
 {
-  QAction* aSeparator = new QAction(this);
+  QAction* aSeparator = ModuleBase_Tools::createAction(QIcon(), "", this);
   aSeparator->setSeparator(true);
 
   QActionsList aList;