*\retval Return -1 if something wrong.
*/
int CAM_Module::createMenu( const QString& subMenu, const int menu,
- const int id, const int group, const int index )
+ const int id, const int group, const int index,
+ const bool enableEmpty )
{
if ( !menuMgr() )
return -1;
- return menuMgr()->insert( subMenu, menu, group, index );
+ return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty );
}
/*! Create menu.
*\retval Return -1 if something wrong.
*/
int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
- const int id, const int group, const int index )
+ const int id, const int group, const int index,
+ const bool enableEmpty )
{
if ( !menuMgr() )
return -1;
- return menuMgr()->insert( subMenu, menu, group, index );
+ return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty );
}
return ident;
}
+/*! Unregister an action.
+ * \param id - id for action.
+ * \retval true if succeded, false if action is used
+ */
+bool CAM_Module::unregisterAction( const int id )
+{
+ return unregisterAction( action( id ) );
+}
+
+/*! Unregister an action.
+ * \param a - action
+ * \retval true if succeded, false if action is used
+ */
+bool CAM_Module::unregisterAction( QAction* a )
+{
+ if ( !a )
+ return false;
+ if ( menuMgr() ) {
+ int id = menuMgr()->actionId( a );
+ if ( id != -1 && menuMgr()->contains( id, -1 ) )
+ return false;
+ }
+ if ( toolMgr() ) {
+ int id = toolMgr()->actionId( a );
+ if ( id != -1 && toolMgr()->contains( id ) )
+ return false;
+ }
+ if ( menuMgr() )
+ menuMgr()->unRegisterAction( menuMgr()->actionId( a ) );
+ if ( toolMgr() )
+ toolMgr()->unRegisterAction( toolMgr()->actionId( a ) );
+ return true;
+}
+
/*! Return qt action manager separator.*/
QAction* CAM_Module::separator()
{
/** @name Create menu methods.*/
//@{
- int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
- int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
+ int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
int createMenu( const int, const int, const int = -1, const int = -1 );
int createMenu( const int, const QString&, const int = -1, const int = -1 );
int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
//@}
int registerAction( const int, QAction* );
+ bool unregisterAction( const int );
+ bool unregisterAction( QAction* );
QAction* createAction( const int, const QString&, const QIconSet&, const QString&,
const QString&, const int, QObject* = 0,
const bool = false, QObject* = 0, const char* = 0 );