X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGuiHelpers%2FStandardApp_Module.cxx;h=089ed379c0b592fa699a38b4e02a5d5aa3dc5bfc;hb=e889e70371b01ab242a4f7c95fa1e9a6d9329e84;hp=2582233781be989e9855f3ab179253e7332a2a4b;hpb=e4b132cf6375e1f4bc1fef8ce9eb7aaf703e2ffc;p=modules%2Fgui.git diff --git a/src/GuiHelpers/StandardApp_Module.cxx b/src/GuiHelpers/StandardApp_Module.cxx index 258223378..089ed379c 100644 --- a/src/GuiHelpers/StandardApp_Module.cxx +++ b/src/GuiHelpers/StandardApp_Module.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2011-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Author : Guillaume Boulant (EDF) +// Author : Guillaume Boulant (EDF) #include "StandardApp_Module.hxx" @@ -114,11 +114,11 @@ int StandardApp_Module::newActionId() { * class. */ int StandardApp_Module::createStandardAction(const QString& label, - QObject * slotobject, - const char* slotmember, - const QString& iconName, - const QString& tooltip, - const int identifier) + QObject * slotobject, + const char* slotmember, + const QString& iconName, + const QString& tooltip, + const int identifier) { // If the tooltip is not defined, we choose instead the label text. @@ -136,7 +136,7 @@ int StandardApp_Module::createStandardAction(const QString& label, } // Creating the action - QAction * action= this->createAction( effIdentifier, label, actionIcon, + QAction * action= this->createAction( effIdentifier, label, actionIcon, label, effToolTip, 0, getApp()->desktop(), false, slotobject, slotmember); @@ -151,12 +151,20 @@ void StandardApp_Module::addActionInToolbar(int actionId) { } /** - * Integrate the action in the default menu + * Integrate action in the specified menu. If the menu is not + * specified, then it is integrated into the menu associated to the + * SALOME module. */ -void StandardApp_Module::addActionInMenubar(int actionId) { - this->createMenu( actionId, _defaultMenuId, 10 ); +void StandardApp_Module::addActionInMenubar(int actionId, int menuId) { + if ( menuId == UNSPECIFIED_INT) { + menuId = _defaultMenuId; + } + this->action( actionId )->setIconVisibleInMenu(true); + this->createMenu( actionId, menuId, 10 ); } + + /** * Add the specified action as an item in the popup menu, with the * specified visible rule. The default is "visible for object browser". @@ -167,6 +175,7 @@ void StandardApp_Module::addActionInPopupMenu(int actionId,const QString& rule) // implement "LightApp_Selection* createSelection() const;" int parentId = -1; QtxPopupMgr* mgr = this->popupMgr(); + this->action( actionId )->setIconVisibleInMenu(true); mgr->insert ( this->action( actionId ), parentId, 0 ); mgr->setRule( this->action( actionId ), rule, QtxPopupMgr::VisibleRule ); } @@ -190,7 +199,7 @@ void StandardApp_Module::createModuleWidgets() { */ void StandardApp_Module::createModuleActions() { int actionId = this->createStandardAction("Test", this, SLOT(OnTest()), - "f1.png", "Run the default test function"); + "f1.png", "Run the default test function"); this->addActionInToolbar(actionId); } @@ -199,7 +208,9 @@ void StandardApp_Module::windows( QMap& theMap ) const { theMap.clear(); theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); +#ifndef DISABLE_PYCONSOLE theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); +#endif } // Module's engine IOR @@ -236,13 +247,13 @@ void StandardApp_Module::setDockLayout(DockLayoutType layoutType) { SUIT_Desktop* desk = getApp()->desktop(); _areaAtBottomLeftCorner = desk->corner(Qt::BottomLeftCorner); _areaAtBottomRightCorner = desk->corner(Qt::BottomRightCorner); - + if ( layoutType == DOCKLAYOUT_LEFT_VLARGE ) { desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); } else { desk->setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea); - desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); + desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); } } @@ -313,8 +324,8 @@ void StandardApp_Module::createStudyComponent(SUIT_Study* theStudy) { // raising (eh, you work on SALOME isn't it?) SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(this->getEngine()); if ( ! driver->_is_nil() ) { - STDLOG("Associate the SComponent to the engine"); - aStudyBuilder->DefineComponentInstance(aFather, this->getEngine()); + STDLOG("Associate the SComponent to the engine"); + aStudyBuilder->DefineComponentInstance(aFather, this->getEngine()); } }