From: nds Date: Tue, 24 May 2016 11:24:23 +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~64 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=854902e275b0daab546cbe4517b8bb71badad4a1;p=modules%2Fshaper.git Issue #1015: The validate icon must be greyed and inactive instead of red and active Actions contain information for Status bar: SHAPER mode --- diff --git a/src/ModuleBase/ModuleBase_ActionInfo.cpp b/src/ModuleBase/ModuleBase_ActionInfo.cpp index b9540f26d..35721b358 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.cpp +++ b/src/ModuleBase/ModuleBase_ActionInfo.cpp @@ -69,24 +69,6 @@ void ModuleBase_ActionInfo::initFrom(std::shared_ptr 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(); diff --git a/src/ModuleBase/ModuleBase_ActionInfo.h b/src/ModuleBase/ModuleBase_ActionInfo.h index a726d137f..1f21c7ca1 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.h +++ b/src/ModuleBase/ModuleBase_ActionInfo.h @@ -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 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() diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 65fe3d596..2afd94495 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -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;