Version: 9.15.0
CAM_Module Class Reference

Base implementation of the module in the CAM application architecture. More...

#include <CAM_Module.h>

Inheritance diagram for CAM_Module:
Inheritance graph

Public Slots

virtual bool activateModule (SUIT_Study *)
 Activate module. More...
 
virtual bool deactivateModule (SUIT_Study *)
 Deactivate module. More...
 
virtual void connectToStudy (CAM_Study *)
 Connect data model of the module to the active study. More...
 
virtual void studyClosed (SUIT_Study *)
 Called when study is closed. More...
 
virtual void studyChanged (SUIT_Study *, SUIT_Study *)
 Called when study is changed (obsolete). More...
 
virtual void onApplicationClosed (SUIT_Application *)
 Called when application is closed. More...
 
virtual void moduleActionActivated ()
 Called when an action is triggered. More...
 

Public Member Functions

 CAM_Module ()
 Default constructor. More...
 
 CAM_Module (const QString &)
 Constructor. More...
 
virtual ~CAM_Module ()
 Destructor. More...
 
virtual void initialize (CAM_Application *)
 Initialize module. More...
 
QString name () const
 Get module (internal) name. More...
 
QString moduleName () const
 Get module title (user name) More...
 
virtual QPixmap moduleIcon () const
 Get module icon. More...
 
virtual QString iconName () const
 Get module icon's name. More...
 
CAM_DataModeldataModel () const
 Get data model. More...
 
CAM_Applicationapplication () const
 Get application. More...
 
virtual void contextMenuPopup (const QString &, QMenu *, QString &)
 Create context popup menu. More...
 
virtual void updateCommandsStatus ()
 Update menu/toolbar actions. More...
 
virtual void putInfo (const QString &, const int=-1)
 Put the text message into the status bar of the application main window. More...
 
int showNotification (const QString &message, const QString &title, int timeout=-1)
 Shows the notifications with spectified text, title and automatic close timeout. Notification will be automatically closed after specified timeout in msec. If timeout is zero then automatic closing doesn't performed. More...
 
void hideNotification (const QString &message)
 Closes the notifications with spectified text. More...
 
void hideNotification (int id)
 Closes the notifications with spectified identifier. More...
 
bool isActiveModule () const
 Check if the module is active. More...
 
virtual void setMenuShown (const bool)
 Show/hide all module's menus. More...
 
void setMenuShown (QAction *, const bool)
 Show/hide specified menu item. More...
 
void setMenuShown (const int, const bool)
 Show/hide specified menu item. More...
 
virtual void setToolShown (const bool)
 Show/hide all module's toolbars. More...
 
void setToolShown (QAction *, const bool)
 Show/hide specified toolbar item. More...
 
void setToolShown (const int, const bool)
 Show/hide specified toolbar item. More...
 
virtual void updateModuleVisibilityState ()
 Update visibility state of the module objects. More...
 
virtual bool activateOperation (int actionId)
 Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation(). More...
 
virtual bool activateOperation (const QString &actionId)
 Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation(). More...
 
virtual bool activateOperation (const QString &actionId, const QString &pluginName)
 Activate GUI operation of module by its ID and pluginName. This method is called from CAM_Application::startOperation(). More...
 
QtxActionMenuMgrmenuMgr () const
 Get menu manager. More...
 
QtxActionToolMgrtoolMgr () const
 Get toolbar manager. More...
 
QString makeActionID (const QString &theInModuleActionID) const
 
virtual QActionaction (const int) const
 Get action by specified id. More...
 
virtual int actionId (const QAction *) const
 Get action ID. More...
 
virtual QActioncreateAction (const int, const QString &, const QIcon &, const QString &, const QString &, const int, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString())
 Create new instance of QtxAction and register action with specified id. More...
 
virtual QActioncreateAction (const int, const QString &, const QIcon &, const QString &, const QString &, const QKeySequence &, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString())
 Create new instance of QtxAction and register action with specified id. More...
 
QtxActionGroupcreateActionGroup (const int, const bool=true)
 Create new action group. More...
 
int createTool (const QString &, const QString &=QString())
 Create toolbar with speicifed name. More...
 
int createTool (const int, const int, const int=-1)
 Add toolbar item. More...
 
int createTool (const int, const QString &, const int=-1)
 Add toolbar item. More...
 
int createTool (QAction *, const int, const int=-1, const int=-1)
 Add toolbar item. More...
 
int createTool (QAction *, const QString &, const int=-1, const int=-1)
 Add toolbar item. More...
 
void clearTool (const QString &title)
 
int createMenu (const QString &, const int, const int=-1, const int=-1, const int=-1, QMenu *=0)
 Create menu or submenu. More...
 
int createMenu (const QString &, const QString &, const int=-1, const int=-1, const int=-1)
 Create menu or submenu. More...
 
int createMenu (const int, const int, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (const int, const QString &, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (QAction *, const int, const int=-1, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (QAction *, const QString &, const int=-1, const int=-1, const int=-1)
 Add menu item. More...
 
virtual void logAction (QAction *)
 Log given action. More...
 
bool isActionLoggingEnabled () const
 Return true if action logging is enabled. More...
 
void setActionLoggingEnabled (bool)
 Enable / disable action logging. More...
 

Static Public Member Functions

static QActionseparator ()
 Create separator action. More...
 

Protected Member Functions

virtual bool isSelectionCompatible ()
 If return false, selection will be cleared at module activation. More...
 
virtual CAM_DataModelcreateDataModel ()
 Create data model. More...
 
void setName (const QString &)
 Set module (internal) name. More...
 
virtual void setModuleName (const QString &)
 Set module title (user name) More...
 
int registerAction (const int, QAction *)
 Register action in the internal action map. More...
 
bool unregisterAction (const int)
 Unregister action from the internal action map. More...
 
bool unregisterAction (QAction *)
 Unregister action from the internal action map. More...
 
virtual bool abortAllOperations ()
 

Protected Attributes

QMap< QAction *, QKeySequence > myActionShortcutMap
 copy actions shortcut map More...
 

Private Slots

void onInfoChanged (QString)
 Restore message info. More...
 

Private Attributes

CAM_ApplicationmyApp
 parent application object More...
 
QString myName
 module title (user name) More...
 
QPixmap myIcon
 module icon More...
 
QString myInfo
 latest info message More...
 
CAM_DataModelmyDataModel
 data model More...
 
QMap< int, QAction * > myActionMap
 menu actions More...
 
bool myMenuShown
 menu shown flag More...
 
bool myToolShown
 tool shown flag More...
 
bool myActionLoggingEnabled
 action logging enabled More...
 

Friends

class CAM_Application
 

Detailed Description

Base implementation of the module in the CAM application architecture.

Provides support of menu/toolbars management.

Constructor & Destructor Documentation

◆ CAM_Module() [1/2]

CAM_Module::CAM_Module ( )

Default constructor.

Creates unnamed module.

◆ CAM_Module() [2/2]

CAM_Module::CAM_Module ( const QString &  name)

Constructor.

Creates module with the specified name.

Parameters
namemodule name

◆ ~CAM_Module()

CAM_Module::~CAM_Module ( )
virtual

Destructor.

Destroy data model.

References myDataModel.

Member Function Documentation

◆ abortAllOperations()

bool CAM_Module::abortAllOperations ( )
protectedvirtual

◆ action()

QAction * CAM_Module::action ( const int  id) const
virtual

Get action by specified id.

Parameters
idaction ID
Returns
action or 0 if not found

References QtxActionMenuMgr::findMenu(), menuMgr(), and myActionMap.

◆ actionId()

int CAM_Module::actionId ( const QAction a) const
virtual

Get action ID.

Parameters
aaction
Returns
action ID or -1 if not found

References myActionMap.

◆ activateModule

bool CAM_Module::activateModule ( SUIT_Study )
virtualslot

Activate module.

This method is called when the user activates module. Successor classes can use this method to customize module activation process, for example, to show own menus, toolbars, etc.

Default implementation always returns true.

Returns
true if module is activated successfully.
See also
initialize(), deactivateModule()

Reimplemented in SALOME_PYQT_ModuleLight, and SALOME_PYQT_Module.

References myActionShortcutMap.

◆ activateOperation() [1/3]

bool CAM_Module::activateOperation ( const QString &  actionId)
virtual

Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation().

Parameters
actionIdis a string unique operation id.

◆ activateOperation() [2/3]

bool CAM_Module::activateOperation ( const QString &  actionId,
const QString &  pluginName 
)
virtual

Activate GUI operation of module by its ID and pluginName. This method is called from CAM_Application::startOperation().

Parameters
actionIdis a string unique operation id.
pluginNameis a name of a plugin where the operation is implemented.

◆ activateOperation() [3/3]

bool CAM_Module::activateOperation ( int  actionId)
virtual

Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation().

Parameters
actionIdis a numerical unique operation id.

◆ application()

CAM_Application * CAM_Module::application ( ) const

Get application.

Returns
application pointer

References myApp.

◆ clearTool()

void CAM_Module::clearTool ( const QString &  title)

Clears given toolbar.

Parameters
title- title of toolbar

References QtxActionToolMgr::clear(), and toolMgr().

◆ connectToStudy

void CAM_Module::connectToStudy ( CAM_Study camStudy)
virtualslot

Connect data model of the module to the active study.

Parameters
camStudyCAM study object

References SUIT_Study::application(), CAM_Study::containsDataModel(), CAM_Study::insertDataModel(), and CAM_Application::modules().

◆ contextMenuPopup()

void CAM_Module::contextMenuPopup ( const QString &  type,
QMenu menu,
QString &  title 
)
inlinevirtual

Create context popup menu.

Parameters
typepopup menu context
menupopup menu
titlepopup menu title, which can be set by the module if required

Reimplemented in SALOME_PYQT_ModuleLight, SALOME_PYQT_Module, and LightApp_Module.

◆ createAction() [1/2]

QAction * CAM_Module::createAction ( const int  id,
const QString &  text,
const QIcon &  icon,
const QString &  menu,
const QString &  tip,
const int  key,
QObject parent = 0,
const bool  toggle = false,
QObject receiver = 0,
const char *  member = 0,
const QString &  inModuleActionID = QString() 
)
virtual

Create new instance of QtxAction and register action with specified id.

Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If id < 0, the action ID is generated automatically.

Parameters
idrequired action ID
texttooltip text
iconaction icon
menumenu text
tipstatus bar tip
keyMay be disabled by SUIT_ShortcutMgr!
parentparent object
toggleif true, the action will be toggled
receiveraction activation signal receiver object
memberaction activation signal receiver slot
inModuleActionIDmodule-unique action ID

◆ createAction() [2/2]

QAction * CAM_Module::createAction ( const int  id,
const QString &  text,
const QIcon &  icon,
const QString &  menu,
const QString &  tip,
const QKeySequence &  key,
QObject parent = 0,
const bool  toggle = false,
QObject receiver = 0,
const char *  member = 0,
const QString &  inModuleActionID = QString() 
)
virtual

Create new instance of QtxAction and register action with specified id.

Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If id < 0, the action ID is generated automatically.

Parameters
idrequired action ID
texttooltip text
iconaction icon
menumenu text
tipstatus bar tip
keyMay be disabled by SUIT_ShortcutMgr!
parentparent object
toggleif true, the action will be toggled
receiveraction activation signal receiver object
memberaction activation signal receiver slot
inModuleActionIDmodule-unique action ID

References makeActionID(), moduleActionActivated(), and registerAction().

◆ createActionGroup()

QtxActionGroup * CAM_Module::createActionGroup ( const int  id,
const bool  exclusive = true 
)

Create new action group.

Parameters
idaction group ID
exclusivetrue for exclusive action group
Returns
created action group

References action(), registerAction(), and QtxActionGroup::setExclusive().

◆ createDataModel()

CAM_DataModel * CAM_Module::createDataModel ( )
protectedvirtual

Create data model.

Returns
created data model object or 0 if it could not be created

Reimplemented in SalomeApp_Module, SALOME_PYQT_ModuleLight, and LightApp_Module.

◆ createMenu() [1/6]

int CAM_Module::createMenu ( const int  id,
const int  menu,
const int  group = -1,
const int  idx = -1 
)

Add menu item.

Insert action with id identifier to the menu manager. It is assumed that action has been already registered.

Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If action has been already added previously, its ID is just returned.

Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.

Parameters
idaction ID
menumenu ID
groupmenu group ID
idxaction index (desired position in the menu group)
Returns
action ID or -1 if menu item could not be added

References action(), QtxActionMenuMgr::insert(), menuMgr(), myMenuShown, and setMenuShown().

◆ createMenu() [2/6]

int CAM_Module::createMenu ( const int  id,
const QString &  menu,
const int  group = -1,
const int  idx = -1 
)

Add menu item.

Insert action with id identifier to the menu manager. It is assumed that action has been already registered.

Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If action has been already added previously, its ID is just returned.

The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.

Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.

Parameters
idaction ID
menumenu name(s)
groupmenu group ID
idxaction index (desired position in the menu group)
Returns
action ID or -1 if menu item could not be added

References action(), QtxActionMenuMgr::insert(), menuMgr(), myMenuShown, and setMenuShown().

◆ createMenu() [3/6]

int CAM_Module::createMenu ( const QString &  subMenu,
const int  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1,
QMenu menuObj = 0 
)

Create menu or submenu.

Create main menu or popup submenu and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If id < 0, the menu ID is generated automatically. If menu has been already created previously, its ID is just returned.

The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.

Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the menu/submenu is added to the end of the menu group.

Parameters
subMenusubMenu name
menuparent menu ID
idrequested menu ID
groupmenu group ID
idxmenu item index (desired position in the menu group)
Returns
menu item ID or -1 if menu item could not be added

References QtxActionMenuMgr::insert(), and menuMgr().

◆ createMenu() [4/6]

int CAM_Module::createMenu ( const QString &  subMenu,
const QString &  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)

Create menu or submenu.

Create main menu or popup submenu and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If id < 0, the menu ID is generated automatically. If menu has been already created previously, its ID is just returned.

The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.

Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the menu/submenu is added to the end of the menu group.

Parameters
subMenusubMenu name
menuparent menu name(s)
idrequested menu ID
groupmenu group ID
idxmenu item index (desired position in the menu group)
Returns
menu item ID or -1 if menu item could not be added

References QtxActionMenuMgr::insert(), and menuMgr().

◆ createMenu() [5/6]

int CAM_Module::createMenu ( QAction a,
const int  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)

Add menu item.

Insert action to the menu manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If id < 0, the action ID is generated automatically.

If action has been already added previously, its ID is just returned.

Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.

Parameters
aaction
menumenu ID
idrequested action ID
groupmenu group ID
idxaction index (desired position in the menu group)
Returns
action ID or -1 if menu item could not be added

References QtxActionMenuMgr::insert(), menuMgr(), myMenuShown, registerAction(), and setMenuShown().

◆ createMenu() [6/6]

int CAM_Module::createMenu ( QAction a,
const QString &  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)

Add menu item.

Insert action to the menu manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If id < 0, the action ID is generated automatically.

If action has been already added previously, its ID is just returned.

The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.

Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.

Parameters
aaction
menumenu name(s)
idrequested action ID
groupmenu group ID
idxaction index (desired position in the menu group)
Returns
action ID or -1 if menu item could not be added

References QtxActionMenuMgr::insert(), menuMgr(), myMenuShown, registerAction(), and setMenuShown().

◆ createTool() [1/5]

int CAM_Module::createTool ( const int  id,
const int  tBar,
const int  idx = -1 
)

Add toolbar item.

Insert action with id identifier to the toolbar manager. It is assumed that action has been already registered.

Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If action has been already added previously, its ID is just returned.

If idx < 0, the action is added to the end of the toolbar.

Parameters
idaction ID
tBartoolbar ID
idxaction index (desired position in the toolbar)
Returns
action ID or -1 if toolbar item could not be added

References action(), QtxActionToolMgr::insert(), myToolShown, setToolShown(), and toolMgr().

◆ createTool() [2/5]

int CAM_Module::createTool ( const int  id,
const QString &  tBar,
const int  idx = -1 
)

Add toolbar item.

Insert action with id identifier to the toolbar manager. It is assumed that action has been already registered.

Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If action has been already added previously, its ID is just returned.

If idx < 0, the action is added to the end of the toolbar.

Parameters
idaction ID
tBartoolbar name
idxaction index (desired position in the toolbar)
Returns
action ID or -1 if toolbar item could not be added

References action(), QtxActionToolMgr::insert(), myToolShown, setToolShown(), and toolMgr().

◆ createTool() [3/5]

int CAM_Module::createTool ( const QString &  title,
const QString &  name = QString() 
)

Create toolbar with speicifed name.

If the toolbar has been already created, its ID is just returned.

Parameters
titletoolbar title
nametoolbar name (identifier)
Returns
toolbar ID or -1 if toolbar could not be created

References QtxActionToolMgr::createToolBar(), myToolShown, name(), and toolMgr().

◆ createTool() [4/5]

int CAM_Module::createTool ( QAction a,
const int  tBar,
const int  id = -1,
const int  idx = -1 
)

Add toolbar item.

Insert action to the toolbar manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If action has been already added previously, its ID is just returned.

If id < 0, the action ID is generated automatically.

If idx < 0, the action is added to the end of the toolbar.

Parameters
aaction
tBartoolbar ID
idrequested action ID
idxaction index (desired position in the toolbar)
Returns
action ID or -1 if toolbar item could not be added

References QtxActionToolMgr::insert(), myToolShown, registerAction(), setToolShown(), and toolMgr().

◆ createTool() [5/5]

int CAM_Module::createTool ( QAction a,
const QString &  tBar,
const int  id = -1,
const int  idx = -1 
)

Add toolbar item.

Insert action to the toolbar manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If action has been already added previously, its ID is just returned.

If id < 0, the action ID is generated automatically.

If idx < 0, the action is added to the end of the toolbar.

Parameters
aaction
tBartoolbar name
idrequested action ID
idxaction index (desired position in the toolbar)
Returns
action ID or -1 if toolbar item could not be added

References QtxActionToolMgr::insert(), myToolShown, registerAction(), setToolShown(), and toolMgr().

◆ dataModel()

CAM_DataModel * CAM_Module::dataModel ( ) const

Get data model.

Creates data model, if it is not yet created.

Returns
data model pointer
See also
createDataModel()

References createDataModel(), CAM_DataModel::initialize(), and myDataModel.

◆ deactivateModule

bool CAM_Module::deactivateModule ( SUIT_Study )
virtualslot

Deactivate module.

This method is called when the user deactivates module. Successor classes can use this method to customize module deactivation process, for example, to hide own menus, toolbars, etc.

Default implementation always returns true.

Returns
true if module is deactivated successfully.
See also
initialize(), activateModule()

Reimplemented in SALOME_PYQT_ModuleLight, and SALOME_PYQT_Module.

References myActionMap, and myActionShortcutMap.

◆ hideNotification() [1/2]

void CAM_Module::hideNotification ( const QString &  message)

Closes the notifications with spectified text.

Parameters
text- Notification text

References application(), and STD_Application::hideNotification().

◆ hideNotification() [2/2]

void CAM_Module::hideNotification ( int  id)

Closes the notifications with spectified identifier.

Parameters
text- Notification text

References application(), and STD_Application::hideNotification().

◆ iconName()

QString CAM_Module::iconName ( ) const
virtual

Get module icon's name.

This function is used to get module icon's file name. Default implementation returns empty string.

Returns
module icon's name.
See also
moduleIcon()

References application(), CAM_Application::moduleIcon(), and name().

◆ initialize()

void CAM_Module::initialize ( CAM_Application app)
virtual

Initialize module.

This method is usually called when the module is created (for example, on the module library loading). Successor classes can use this method to create menu/toolbar actions and perform other module initialization.

Parameters
appparent application object
See also
activateModule(), deactivateModule()

Reimplemented in SALOME_PYQT_ModuleLight, SALOME_PYQT_Module, LightApp_Module, and StandardApp_Module.

References myApp, onApplicationClosed(), onInfoChanged(), and SUIT_Session::session().

◆ isActionLoggingEnabled()

bool CAM_Module::isActionLoggingEnabled ( ) const

Return true if action logging is enabled.

References myActionLoggingEnabled.

◆ isActiveModule()

bool CAM_Module::isActiveModule ( ) const

Check if the module is active.

Returns
true if module is active.

References CAM_Application::activeModule(), and application().

◆ isSelectionCompatible()

bool CAM_Module::isSelectionCompatible ( )
protectedvirtual

If return false, selection will be cleared at module activation.

Reimplemented in LightApp_Module.

◆ logAction()

void CAM_Module::logAction ( QAction action)
virtual

Log given action.

Parameters
actionGUI action being logged.

Default implementation just forwards to CAM_Applicaion::logAction();

References action(), CAM_Application::logAction(), and moduleName().

◆ makeActionID()

QString CAM_Module::makeActionID ( const QString &  theInModuleActionID) const

◆ menuMgr()

QtxActionMenuMgr * CAM_Module::menuMgr ( ) const

Get menu manager.

Returns
menu manager pointer

References application(), SUIT_Application::desktop(), and SUIT_Desktop::menuMgr().

◆ moduleActionActivated

void CAM_Module::moduleActionActivated ( )
virtualslot

Called when an action is triggered.

References action(), isActionLoggingEnabled(), and logAction().

◆ moduleIcon()

QPixmap CAM_Module::moduleIcon ( ) const
virtual

Get module icon.

Returns
module icon pixmap
See also
iconName()

References application(), iconName(), QtxResourceMgr::loadPixmap(), myIcon, name(), and SUIT_Application::resourceMgr().

◆ moduleName()

QString CAM_Module::moduleName ( ) const

Get module title (user name)

Returns
module title
See also
setModuleName(), name(), setName()

References myName.

◆ name()

QString CAM_Module::name ( ) const

Get module (internal) name.

Returns
module name
See also
setName(), moduleName(), setModuleName()

◆ onApplicationClosed

void CAM_Module::onApplicationClosed ( SUIT_Application theApp)
virtualslot

Called when application is closed.

Nullify application pointer if the application is being closed.

Parameters
theAppapplication

References myApp.

◆ onInfoChanged

void CAM_Module::onInfoChanged ( QString  txt)
privateslot

Restore message info.

Restores constant text message when previous information status message is removed.

Parameters
txtprevious message (being removed)
See also
putInfo()

References application(), isActiveModule(), myInfo, and SUIT_Application::putInfo().

◆ putInfo()

void CAM_Module::putInfo ( const QString &  msg,
const int  msec = -1 
)
virtual

Put the text message into the status bar of the application main window.

If msec > 0, the message will be shown msec milliseconds. If msec < 0, the message will be constantly displayed until module is active.

Parameters
msgtext message
msecmessage displaying duration in milliseconds

References application(), myInfo, and SUIT_Application::putInfo().

◆ registerAction()

int CAM_Module::registerAction ( const int  id,
QAction a 
)
protected

Register action in the internal action map.

If action has been already added previously, its ID is just returned. If id < 0, the action ID is generated automatically.

Parameters
idaction required ID
aaction
Returns
action ID

References application(), SUIT_Application::desktop(), menuMgr(), myActionMap, QtxActionMgr::registerAction(), and toolMgr().

◆ separator()

QAction * CAM_Module::separator ( )
static

Create separator action.

Separator action can be used in menus or toolbars.

Returns
new separator action

References QtxActionMgr::separator().

◆ setActionLoggingEnabled()

void CAM_Module::setActionLoggingEnabled ( bool  enabled)

Enable / disable action logging.

Parameters
enabledtrue to enable logging, or false to disable it.

References myActionLoggingEnabled.

◆ setMenuShown() [1/3]

void CAM_Module::setMenuShown ( const bool  on)
virtual

Show/hide all module's menus.

Parameters
onif true, show menus, otherwise, hide all menus
See also
setToolShown()

References QtxActionMgr::actionId(), QtxActionMgr::isUpdatesEnabled(), menuMgr(), myActionMap, myMenuShown, separator(), QtxActionMenuMgr::setShown(), QtxActionMgr::setUpdatesEnabled(), and QtxActionMgr::update().

◆ setMenuShown() [2/3]

void CAM_Module::setMenuShown ( const int  id,
const bool  on 
)

Show/hide specified menu item.

Parameters
idmenu item ID
onif true, show menu item, otherwise, hide it

References action(), and setMenuShown().

◆ setMenuShown() [3/3]

void CAM_Module::setMenuShown ( QAction a,
const bool  on 
)

Show/hide specified menu item.

Parameters
aaction
onif true, show menu item, otherwise, hide it

References actionId(), menuMgr(), and QtxActionMenuMgr::setShown().

◆ setModuleName()

void CAM_Module::setModuleName ( const QString &  name)
protectedvirtual

Set module title (user name)

Parameters
namenew module title
See also
moduleName(), name(), setName()

References myName, and name().

◆ setName()

void CAM_Module::setName ( const QString &  name)
protected

Set module (internal) name.

Parameters
namenew module name
See also
name(), moduleName(), setModuleName()

References name().

◆ setToolShown() [1/3]

void CAM_Module::setToolShown ( const bool  on)
virtual

Show/hide all module's toolbars.

Parameters
onif true, show toolbars, otherwise, hide all toolbars
See also
setMenuShown()

References QtxActionMgr::actionId(), QtxActionMgr::isUpdatesEnabled(), myActionMap, myToolShown, separator(), QtxActionToolMgr::setShown(), QtxActionMgr::setUpdatesEnabled(), toolMgr(), and QtxActionMgr::update().

◆ setToolShown() [2/3]

void CAM_Module::setToolShown ( const int  id,
const bool  on 
)

Show/hide specified toolbar item.

Parameters
idtoolbar item ID
onif true, show toolbar item, otherwise, hide it

References action(), and setToolShown().

◆ setToolShown() [3/3]

void CAM_Module::setToolShown ( QAction a,
const bool  on 
)

Show/hide specified toolbar item.

Parameters
aaction
onif true, show toolbar item, otherwise, hide it

References actionId(), QtxActionToolMgr::setShown(), and toolMgr().

◆ showNotification()

int CAM_Module::showNotification ( const QString &  message,
const QString &  title,
int  timeout = -1 
)

Shows the notifications with spectified text, title and automatic close timeout. Notification will be automatically closed after specified timeout in msec. If timeout is zero then automatic closing doesn't performed.

Parameters
text- Notification text
title- Notification title
timeout- Notification close timeout in msec
Returns
notification identifier

References application(), and STD_Application::showNotification().

◆ studyChanged

void CAM_Module::studyChanged ( SUIT_Study ,
SUIT_Study  
)
virtualslot

Called when study is changed (obsolete).

Default implementation does nothing.

Parameters
oldStudyold study
newStudynew study

◆ studyClosed

void CAM_Module::studyClosed ( SUIT_Study study)
virtualslot

Called when study is closed.

Removes data model from the study.

Parameters
studystudy being closed

Reimplemented in SALOME_PYQT_Module.

References CAM_DataModel::close(), CAM_Study::containsDataModel(), dataModel(), and CAM_Study::removeDataModel().

◆ toolMgr()

QtxActionToolMgr * CAM_Module::toolMgr ( ) const

Get toolbar manager.

Returns
toolbar manager pointer

References application(), SUIT_Application::desktop(), and SUIT_Desktop::toolMgr().

◆ unregisterAction() [1/2]

bool CAM_Module::unregisterAction ( const int  id)
protected

Unregister action from the internal action map.

Parameters
idaction ID
Returns
true on success or false if action is in use

References action().

◆ unregisterAction() [2/2]

bool CAM_Module::unregisterAction ( QAction a)
protected

Unregister action from the internal action map.

Parameters
aaction
Returns
true on success or false if action is in use

References actionId(), QtxActionMgr::actionId(), menuMgr(), toolMgr(), and QtxActionMgr::unRegisterAction().

◆ updateCommandsStatus()

void CAM_Module::updateCommandsStatus ( )
inlinevirtual

Update menu/toolbar actions.

◆ updateModuleVisibilityState()

void CAM_Module::updateModuleVisibilityState ( )
virtual

Update visibility state of the module objects.

Reimplemented in LightApp_Module.

Friends And Related Function Documentation

◆ CAM_Application

friend class CAM_Application
friend

Member Data Documentation

◆ myActionLoggingEnabled

bool CAM_Module::myActionLoggingEnabled
private

action logging enabled

◆ myActionMap

QMap<int, QAction*> CAM_Module::myActionMap
private

menu actions

◆ myActionShortcutMap

QMap<QAction*, QKeySequence> CAM_Module::myActionShortcutMap
protected

copy actions shortcut map

◆ myApp

CAM_Application* CAM_Module::myApp
private

parent application object

◆ myDataModel

CAM_DataModel* CAM_Module::myDataModel
private

data model

◆ myIcon

QPixmap CAM_Module::myIcon
private

module icon

◆ myInfo

QString CAM_Module::myInfo
private

latest info message

◆ myMenuShown

bool CAM_Module::myMenuShown
private

menu shown flag

◆ myName

QString CAM_Module::myName
private

module title (user name)

◆ myToolShown

bool CAM_Module::myToolShown
private

tool shown flag


The documentation for this class was generated from the following files: