1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "CAM_Module.h"
25 #include "CAM_DataModel.h"
26 #include "CAM_Application.h"
27 #include "CAM_Study.h"
29 #include <QtxAction.h>
30 #include <QtxActionGroup.h>
31 #include <QtxActionMenuMgr.h>
32 #include <QtxActionToolMgr.h>
34 #include <SUIT_Desktop.h>
35 #include <SUIT_Session.h>
36 #include <SUIT_ResourceMgr.h>
42 \brief Base implementation of the module in the CAM application architecture.
44 Provides support of menu/toolbars management.
50 ActionMgrLocker( QtxActionMgr* m, bool use ) : myMgr( m ), myUseLock( use )
53 myUpdEnabled = myMgr->isUpdatesEnabled();
54 myMgr->setUpdatesEnabled( false );
60 myMgr->setUpdatesEnabled( myUpdEnabled );
71 \brief Default constructor.
73 Creates unnamed module.
75 CAM_Module::CAM_Module()
85 Creates module with the specified \a name.
87 \param name module name
89 CAM_Module::CAM_Module( const QString& name )
104 CAM_Module::~CAM_Module()
111 \brief Initialize module.
113 This method is usually called when the module is created (for example,
114 on the module library loading).
115 Successor classes can use this method to create menu/toolbar actions
116 and perform other module initialization.
118 \param app parent application object
119 \sa activateModule(), deactivateModule()
121 void CAM_Module::initialize( CAM_Application* app )
126 SUIT_Session* aSession = SUIT_Session::session();
127 connect( aSession, SIGNAL( applicationClosed( SUIT_Application* ) ),
128 this, SLOT( onApplicationClosed( SUIT_Application* ) ) );
130 connect( myApp, SIGNAL( infoChanged( QString ) ), this, SLOT( onInfoChanged( QString ) ) );
135 \brief Get module icon.
136 \return module icon pixmap
139 QPixmap CAM_Module::moduleIcon() const
141 if ( myIcon.isNull() ) {
142 QString iname = iconName();
143 if ( !iname.isEmpty() ) {
144 CAM_Module* that = (CAM_Module*)this;
145 that->myIcon = application()->resourceMgr()->loadPixmap( name(), iname, false );
152 \brief Get module icon's name.
154 This function is used to get module icon's file name.
155 Default implementation returns empty string.
157 \return module icon's name.
160 QString CAM_Module::iconName() const
162 return application()->moduleIcon( name() );
166 \brief Get module (internal) name
168 \sa setName(), moduleName(), setModuleName()
170 QString CAM_Module::name() const
176 \brief Get module title (user name)
178 \sa setModuleName(), name(), setName()
180 QString CAM_Module::moduleName() const
186 \brief Get data model.
188 Creates data model, if it is not yet created.
190 \return data model pointer
191 \sa createDataModel()
193 CAM_DataModel* CAM_Module::dataModel() const
197 CAM_Module* that = (CAM_Module*)this;
198 that->myDataModel = that->createDataModel();
199 that->myDataModel->initialize();
205 \brief Get application.
206 \return application pointer
208 CAM_Application* CAM_Module::application() const
214 \brief If return false, selection will be cleared at module activation
216 bool CAM_Module::isSelectionCompatible()
222 \brief Activate module.
224 This method is called when the user activates module.
225 Successor classes can use this method to customize module activation process,
226 for example, to show own menus, toolbars, etc.
228 Default implementation always returns \c true.
230 \return \c true if module is activated successfully.
231 \sa initialize(), deactivateModule()
233 bool CAM_Module::activateModule( SUIT_Study* /*study*/ )
235 // IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
236 // after activate/deactivate modules
237 for ( QMap<QPair<int, QAction*>, QKeySequence>::Iterator it = myActionShortcutMap.begin(); it != myActionShortcutMap.end(); ++it )
239 myActionMap.insert( it.key().first, it.key().second );
240 // Reset actions accelerator keys
241 it.key().second->setShortcut( it.value() );
243 myActionShortcutMap.clear();
248 \brief Deactivate module.
250 This method is called when the user deactivates module.
251 Successor classes can use this method to customize module deactivation process,
252 for example, to hide own menus, toolbars, etc.
254 Default implementation always returns \c true.
256 \return \c true if module is deactivated successfully.
257 \sa initialize(), activateModule()
259 bool CAM_Module::deactivateModule( SUIT_Study* )
261 // IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
262 // after activate/deactivate modules
263 myActionShortcutMap.clear();
264 for ( QMap<int, QAction*>::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it )
266 myActionShortcutMap.insert( qMakePair( it.key(), it.value() ), it.value()->shortcut() );
273 \brief Called when study is closed.
275 Removes data model from the \a study.
277 \param study study being closed
279 void CAM_Module::studyClosed( SUIT_Study* study )
281 CAM_Study* camDoc = dynamic_cast<CAM_Study*>( study );
285 CAM_DataModel* dm = dataModel();
286 if ( dm && camDoc->containsDataModel( dm ) ) {
288 camDoc->removeDataModel( dm );
293 \brief Called when study is changed (obsolete).
295 Default implementation does nothing.
297 \param oldStudy old study
298 \param newStudy new study
300 void CAM_Module::studyChanged( SUIT_Study* /*oldStudy*/, SUIT_Study* /*newStudy*/ )
305 \brief Check if the module is active.
306 \return \c true if module is active.
308 bool CAM_Module::isActiveModule() const
310 return application() ? application()->activeModule() == this : false;
314 \brief Put the text message into the status bar of the application main window.
316 If \a msec > 0, the message will be shown \a msec milliseconds.
317 If \a msec < 0, the message will be constantly displayed until module is active.
319 \param msg text message
320 \param msec message displaying duration in milliseconds
322 void CAM_Module::putInfo( const QString& msg, const int msec )
325 application()->putInfo( msg, msec );
332 \brief Restore message info.
334 Restores constant text message when previous information status message is removed.
336 \param txt previous message (being removed)
339 void CAM_Module::onInfoChanged( QString txt )
341 if ( txt.isEmpty() && isActiveModule() && !myInfo.isEmpty() && application() )
342 application()->putInfo( myInfo );
346 \brief Called when application is closed.
348 Nullify application pointer if the application is being closed.
350 \param theApp application
352 void CAM_Module::onApplicationClosed( SUIT_Application* theApp )
359 \brief Create data model.
360 \return created data model object or 0 if it could not be created
362 CAM_DataModel* CAM_Module::createDataModel()
364 return new CAM_DataModel( this );
368 \brief Set module (internal) name
369 \param name new module name
370 \sa name(), moduleName(), setModuleName()
372 void CAM_Module::setName( const QString& name )
374 setObjectName( name );
378 \brief Set module title (user name)
379 \param name new module title
380 \sa moduleName(), name(), setName()
382 void CAM_Module::setModuleName( const QString& name )
388 \brief Get menu manager.
389 \return menu manager pointer
391 QtxActionMenuMgr* CAM_Module::menuMgr() const
393 QtxActionMenuMgr* mgr = 0;
394 if ( application() && application()->desktop() )
395 mgr = application()->desktop()->menuMgr();
400 \brief Get toolbar manager.
401 \return toolbar manager pointer
403 QtxActionToolMgr* CAM_Module::toolMgr() const
405 QtxActionToolMgr* mgr = 0;
406 if ( application() && application()->desktop() )
407 mgr = application()->desktop()->toolMgr();
412 \brief Create toolbar with speicifed \a name.
414 If the toolbar has been already created, its ID is just returned.
416 \param title toolbar title
417 \param name toolbar name (identifier)
418 \return toolbar ID or -1 if toolbar could not be created
420 int CAM_Module::createTool( const QString& title, const QString& name )
425 ActionMgrLocker lock( toolMgr(), !myToolShown );
427 return toolMgr()->createToolBar( title, name );
431 \brief Add toolbar item.
433 Insert action \a to the toolbar manager and register it with specified \a id.
434 Resulting action ID may differ from the requested one. This can happen if
435 requested ID is already in use.
437 If action has been already added previously, its ID is just returned.
439 If \a id < 0, the action ID is generated automatically.
441 If \a idx < 0, the action is added to the end of the toolbar.
444 \param tBar toolbar ID
445 \param id requested action ID
446 \param idx action index (desired position in the toolbar)
447 \return action ID or -1 if toolbar item could not be added
449 int CAM_Module::createTool( QAction* a, const int tBar, const int id, const int idx )
454 ActionMgrLocker lock( toolMgr(), !myToolShown );
456 int regId = registerAction( id, a );
457 int intId = toolMgr()->insert( a, tBar, idx );
460 setToolShown( a, false );
462 return intId != -1 ? regId : -1;
466 \brief Add toolbar item.
468 Insert action \a to the toolbar manager and register it with specified \a id.
469 Resulting action ID may differ from the requested one. This can happen if
470 requested ID is already in use.
472 If action has been already added previously, its ID is just returned.
474 If \a id < 0, the action ID is generated automatically.
476 If \a idx < 0, the action is added to the end of the toolbar.
479 \param tBar toolbar name
480 \param id requested action ID
481 \param idx action index (desired position in the toolbar)
482 \return action ID or -1 if toolbar item could not be added
484 int CAM_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx )
489 ActionMgrLocker lock( toolMgr(), !myToolShown );
491 int regId = registerAction( id, a );
492 int intId = toolMgr()->insert( a, tBar, idx );
495 setToolShown( a, false );
497 return intId != -1 ? regId : -1;
501 \brief Add toolbar item.
503 Insert action with \a id identifier to the toolbar manager.
504 It is assumed that action has been already registered.
506 Resulting action ID may differ from the requested one. This can happen if
507 requested ID is already in use.
509 If action has been already added previously, its ID is just returned.
511 If \a idx < 0, the action is added to the end of the toolbar.
514 \param tBar toolbar ID
515 \param idx action index (desired position in the toolbar)
516 \return action ID or -1 if toolbar item could not be added
518 int CAM_Module::createTool( const int id, const int tBar, const int idx )
523 ActionMgrLocker lock( toolMgr(), !myToolShown );
525 int intId = toolMgr()->insert( action( id ), tBar, idx );
528 setToolShown( action( id ), false );
530 return intId != -1 ? id : -1;
534 \brief Add toolbar item.
536 Insert action with \a id identifier to the toolbar manager.
537 It is assumed that action has been already registered.
539 Resulting action ID may differ from the requested one. This can happen if
540 requested ID is already in use.
542 If action has been already added previously, its ID is just returned.
544 If \a idx < 0, the action is added to the end of the toolbar.
547 \param tBar toolbar name
548 \param idx action index (desired position in the toolbar)
549 \return action ID or -1 if toolbar item could not be added
551 int CAM_Module::createTool( const int id, const QString& tBar, const int idx )
556 ActionMgrLocker lock( toolMgr(), !myToolShown );
558 int intId = toolMgr()->insert( action( id ), tBar, idx );
561 setToolShown( action( id ), false );
563 return intId != -1 ? id : -1;
567 \brief Create menu or submenu.
569 Create main menu or popup submenu and register it with specified \a id.
570 Resulting action ID may differ from the requested one. This can happen if
571 requested ID is already in use.
573 If \a id < 0, the menu ID is generated automatically.
574 If menu has been already created previously, its ID is just returned.
576 The \a menu parameter represents the menu name - it could be a sequence
577 of strings, separated by '|' symbol. For example, "File|Edit" means
578 File->Edit submenu. If menu doesn't exist, it is created automatically.
580 Parameter \a idx defines the index of the menu item in the menu group which
581 is defined by the \a group. If \a idx < 0, the menu/submenu is added to the
582 end of the menu group.
584 \param subMenu subMenu name
585 \param menu parent menu ID
586 \param id requested menu ID
587 \param group menu group ID
588 \param idx menu item index (desired position in the menu group)
589 \return menu item ID or -1 if menu item could not be added
591 int CAM_Module::createMenu( const QString& subMenu, const int menu,
592 const int id, const int group, const int idx, QMenu * menuObj )
597 return menuMgr()->insert( subMenu, menu, group, id, idx, menuObj );
601 \brief Create menu or submenu.
603 Create main menu or popup submenu and register it with specified \a id.
604 Resulting action ID may differ from the requested one. This can happen if
605 requested ID is already in use.
607 If \a id < 0, the menu ID is generated automatically.
608 If menu has been already created previously, its ID is just returned.
610 The \a menu parameter represents the menu name - it could be a sequence
611 of strings, separated by '|' symbol. For example, "File|Edit" means
612 File->Edit submenu. If menu doesn't exist, it is created automatically.
614 Parameter \a idx defines the index of the menu item in the menu group which
615 is defined by the \a group. If \a idx < 0, the menu/submenu is added to the
616 end of the menu group.
618 \param subMenu subMenu name
619 \param menu parent menu name(s)
620 \param id requested menu ID
621 \param group menu group ID
622 \param idx menu item index (desired position in the menu group)
623 \return menu item ID or -1 if menu item could not be added
625 int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
626 const int id, const int group, const int idx )
631 return menuMgr()->insert( subMenu, menu, group, id, idx );
635 \brief Add menu item.
637 Insert action \a to the menu manager and register it with specified \a id.
638 Resulting action ID may differ from the requested one. This can happen if
639 requested ID is already in use.
641 If \a id < 0, the action ID is generated automatically.
643 If action has been already added previously, its ID is just returned.
645 Parameter \a idx defines the index of the menu item in the menu group which
646 is defined by the \a group. If \a idx < 0, the action is added to the
647 end of the menu group.
651 \param id requested action ID
652 \param group menu group ID
653 \param idx action index (desired position in the menu group)
654 \return action ID or -1 if menu item could not be added
656 int CAM_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx )
658 if ( !a || !menuMgr() )
661 ActionMgrLocker lock( menuMgr(), !myMenuShown );
663 int regId = registerAction( id, a );
664 int intId = menuMgr()->insert( a, menu, group, idx );
667 setMenuShown( a, false );
669 return intId != -1 ? regId : -1;
673 \brief Add menu item.
675 Insert action \a to the menu manager and register it with specified \a id.
676 Resulting action ID may differ from the requested one. This can happen if
677 requested ID is already in use.
679 If \a id < 0, the action ID is generated automatically.
681 If action has been already added previously, its ID is just returned.
683 The \a menu parameter represents the menu name - it could be a sequence
684 of strings, separated by '|' symbol. For example, "File|Edit" means
685 File->Edit submenu. If menu doesn't exist, it is created automatically.
687 Parameter \a idx defines the index of the menu item in the menu group which
688 is defined by the \a group. If \a idx < 0, the action is added to the
689 end of the menu group.
692 \param menu menu name(s)
693 \param id requested action ID
694 \param group menu group ID
695 \param idx action index (desired position in the menu group)
696 \return action ID or -1 if menu item could not be added
698 int CAM_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx )
700 if ( !a || !menuMgr() )
703 ActionMgrLocker lock( menuMgr(), !myMenuShown );
705 int regId = registerAction( id, a );
706 int intId = menuMgr()->insert( a, menu, group, idx );
709 setMenuShown( a, false );
711 return intId != -1 ? regId : -1;
715 \brief Add menu item.
717 Insert action with \a id identifier to the menu manager.
718 It is assumed that action has been already registered.
720 Resulting action ID may differ from the requested one. This can happen if
721 requested ID is already in use.
723 If action has been already added previously, its ID is just returned.
725 Parameter \a idx defines the index of the menu item in the menu group which
726 is defined by the \a group. If \a idx < 0, the action is added to the
727 end of the menu group.
731 \param group menu group ID
732 \param idx action index (desired position in the menu group)
733 \return action ID or -1 if menu item could not be added
735 int CAM_Module::createMenu( const int id, const int menu, const int group, const int idx )
740 ActionMgrLocker lock( menuMgr(), !myMenuShown );
742 int intId = menuMgr()->insert( action( id ), menu, group, idx );
745 setMenuShown( action( id ), false );
747 return intId != -1 ? id : -1;
751 \brief Add menu item.
753 Insert action with \a id identifier to the menu manager.
754 It is assumed that action has been already registered.
756 Resulting action ID may differ from the requested one. This can happen if
757 requested ID is already in use.
759 If action has been already added previously, its ID is just returned.
761 The \a menu parameter represents the menu name - it could be a sequence
762 of strings, separated by '|' symbol. For example, "File|Edit" means
763 File->Edit submenu. If menu doesn't exist, it is created automatically.
765 Parameter \a idx defines the index of the menu item in the menu group which
766 is defined by the \a group. If \a idx < 0, the action is added to the
767 end of the menu group.
770 \param menu menu name(s)
771 \param group menu group ID
772 \param idx action index (desired position in the menu group)
773 \return action ID or -1 if menu item could not be added
775 int CAM_Module::createMenu( const int id, const QString& menu, const int group, const int idx )
780 ActionMgrLocker lock( menuMgr(), !myMenuShown );
782 int intId = menuMgr()->insert( action( id ), menu, group, idx );
785 setMenuShown( action( id ), false );
787 return intId != -1 ? id : -1;
791 \brief Show/hide all module's menus.
792 \param on if \c true, show menus, otherwise, hide all menus
795 void CAM_Module::setMenuShown( const bool on )
799 QtxActionMenuMgr* mMgr = menuMgr();
803 bool upd = mMgr->isUpdatesEnabled();
804 mMgr->setUpdatesEnabled( false );
806 QAction* sep = separator();
807 for ( QMap<int, QAction*>::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it )
809 if ( it.value() != sep )
810 mMgr->setShown( mMgr->actionId( it.value() ), on );
813 mMgr->setUpdatesEnabled( upd );
819 \brief Show/hide specified menu item.
821 \param on if \c true, show menu item, otherwise, hide it
823 void CAM_Module::setMenuShown( QAction* a, const bool on )
826 menuMgr()->setShown( menuMgr()->actionId( a ), on );
830 \brief Show/hide specified menu item.
831 \param id menu item ID
832 \param on if \c true, show menu item, otherwise, hide it
834 void CAM_Module::setMenuShown( const int id, const bool on )
836 setMenuShown( action( id ), on );
840 \brief Show/hide all module's toolbars.
841 \param on if \c true, show toolbars, otherwise, hide all toolbars
844 void CAM_Module::setToolShown( const bool on )
848 QtxActionToolMgr* tMgr = toolMgr();
852 bool upd = tMgr->isUpdatesEnabled();
853 tMgr->setUpdatesEnabled( false );
855 QAction* sep = separator();
856 for ( QMap<int, QAction*>::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it )
858 if ( it.value() != sep )
859 tMgr->setShown( tMgr->actionId( it.value() ), on );
862 tMgr->setUpdatesEnabled( upd );
868 \brief Show/hide specified toolbar item.
870 \param on if \c true, show toolbar item, otherwise, hide it
872 void CAM_Module::setToolShown( QAction* a, const bool on )
875 toolMgr()->setShown( toolMgr()->actionId( a ), on );
879 \brief Show/hide specified toolbar item.
880 \param id toolbar item ID
881 \param on if \c true, show toolbar item, otherwise, hide it
883 void CAM_Module::setToolShown( const int id, const bool on )
885 setToolShown( action( id ), on );
889 \brief Get action by specified \a id.
891 \return action or 0 if not found
893 QAction* CAM_Module::action( const int id ) const
896 if ( myActionMap.contains( id ) )
898 else if ( menuMgr() ) {
899 QMenu* m = menuMgr()->findMenu( id );
900 if ( m ) a = m->menuAction();
906 \brief Get action ID.
908 \return action ID or -1 if not found
910 int CAM_Module::actionId( const QAction* a ) const
913 for ( QMap<int, QAction*>::ConstIterator it = myActionMap.begin(); it != myActionMap.end() && id == -1; ++it )
915 if ( it.value() == a )
922 \brief Create new instance of QtxAction and register action with specified \a id.
924 Resulting action ID may differ from the requested one. This can happen if
925 requested ID is already in use.
927 If \a id < 0, the action ID is generated automatically.
929 \param id required action ID
930 \param text tooltip text
931 \param icon action icon
932 \param menu menu text
933 \param tip status bar tip
934 \param key keyboard accelerator
935 \param parent parent object
936 \param toggle if \c true, the action will be toggled
937 \param reciever action activation signal receiver object
938 \param member action activation signal receiver slot
940 QAction* CAM_Module::createAction( const int id, const QString& text, const QIcon& icon,
941 const QString& menu, const QString& tip, const int key,
942 QObject* parent, const bool toggle, QObject* reciever,
943 const char* member, const QString& shortcutAction )
945 QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction );
946 a->setStatusTip( tip );
948 if ( reciever && member )
949 connect( a, SIGNAL( triggered( bool ) ), reciever, member );
951 registerAction( id, a );
957 \brief Create new action group.
958 \param id action group ID
959 \param exclusive \c true for exclusive action group
960 \return created action group
962 QtxActionGroup* CAM_Module::createActionGroup( const int id, const bool exclusive )
964 QtxActionGroup* a = qobject_cast<QtxActionGroup*>( action( id ) );
966 a = new QtxActionGroup( this );
967 registerAction( id, a );
969 a->setExclusive( exclusive );
974 \brief Register action in the internal action map.
976 If action has been already added previously, its ID is just returned.
977 If \a id < 0, the action ID is generated automatically.
979 \param id action required ID
983 int CAM_Module::registerAction( const int id, QAction* a )
986 for ( QMap<int, QAction*>::ConstIterator it = myActionMap.begin(); it != myActionMap.end() && ident == -1; ++it )
987 if ( it.value() == a )
993 static int generatedId = -1;
994 ident = id < 0 ? --generatedId : id;
996 myActionMap.insert( ident, a );
999 menuMgr()->registerAction( a );
1002 toolMgr()->registerAction( a );
1004 if ( application() && application()->desktop() )
1005 application()->desktop()->addAction( a );
1011 \brief Unregister action from the internal action map.
1014 \return \c true on success or \c false if action is in use
1016 bool CAM_Module::unregisterAction( const int id )
1018 return unregisterAction( action( id ) );
1022 \brief Unregister action from the internal action map.
1025 \return \c true on success or \c false if action is in use
1027 bool CAM_Module::unregisterAction( QAction* a )
1032 int id = menuMgr()->actionId( a );
1033 if ( id != -1 && menuMgr()->containsMenu( id, -1 ) )
1037 int id = toolMgr()->actionId( a );
1038 if ( id != -1 && toolMgr()->containsAction( id ) )
1042 menuMgr()->unRegisterAction( menuMgr()->actionId( a ) );
1044 toolMgr()->unRegisterAction( toolMgr()->actionId( a ) );
1049 \brief Create separator action.
1051 Separator action can be used in menus or toolbars.
1053 \return new separator action
1055 QAction* CAM_Module::separator()
1057 return QtxActionMgr::separator();
1061 \brief Update visibility state of the module objects.
1063 void CAM_Module::updateModuleVisibilityState() {
1068 \brief Activate GUI operation of module by its ID.
1069 This method is called from CAM_Application::startOperation().
1070 \param actionId is a numerical unique operation id.
1072 bool CAM_Module::activateOperation( int actionId )
1078 \brief Activate GUI operation of module by its ID.
1079 This method is called from CAM_Application::startOperation().
1080 \param actionId is a string unique operation id.
1082 bool CAM_Module::activateOperation( const QString& actionId )
1088 \brief Activate GUI operation of module by its ID and \a pluginName.
1089 This method is called from CAM_Application::startOperation().
1090 \param actionId is a string unique operation id.
1091 \param pluginName is a name of a plugin where the operation is implemented.
1093 bool CAM_Module::activateOperation( const QString& actionId, const QString& pluginName )
1100 \brief Connect data model of the module to the active study
1101 \param camStudy CAM study object
1103 void CAM_Module::connectToStudy( CAM_Study* camStudy )
1105 CAM_Application* app = camStudy ? dynamic_cast<CAM_Application*>( camStudy->application() ) : 0;
1109 CAM_DataModel* prev = 0;
1110 CAM_Application::ModuleList mods = app->modules();
1111 for( QList<CAM_Module*>::const_iterator it = mods.begin(); it != mods.end(); ++it )
1113 CAM_DataModel* dm = (*it)->dataModel();
1114 if( (*it) == this && !camStudy->containsDataModel( dm ) )
1117 camStudy->insertDataModel( (*it)->dataModel(), prev );
1119 camStudy->insertDataModel( (*it)->dataModel(), 0 );
1126 \fn void CAM_Module::contextMenuPopup( const QString& type, QMenu* menu, QString& title );
1127 \brief Create context popup menu.
1128 \param type popup menu context
1129 \param menu popup menu
1130 \param title popup menu title, which can be set by the module if required
1134 \fn void CAM_Module::updateCommandsStatus();
1135 \brief Update menu/toolbar actions.