QStringList modList;
modules( modList, false );
- if( modList.count()>1 )
+ if( modList.count() > 1 )
{
- QToolBar* modTBar = new QtxToolBar( true, desk );
- modTBar->setObjectName( "ModuleToolBar" );
- modTBar->setWindowTitle( tr( "INF_TOOLBAR_MODULES" ) );
- desktop()->addToolBar( Qt::TopToolBarArea, modTBar );
+ int modTBar = createTool( tr( "INF_TOOLBAR_MODULES" ) );
- myModuleAction = new LightApp_ModuleAction( tr( "APP_NAME" ), defIcon, desk );
+ LightApp_ModuleAction* moduleAction =
+ new LightApp_ModuleAction( tr( "APP_NAME" ), defIcon, desk );
QMap<QString, QString> iconMap;
moduleIconNames( iconMap );
icon.fromImage( icon.toImage().scaled( iconSize, iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
- myModuleAction->insertModule( *it, icon );
+ moduleAction->insertModule( *it, icon );
}
- connect( myModuleAction, SIGNAL( moduleActivated( const QString& ) ), this, SLOT( onModuleActivation( const QString& ) ) );
- modTBar->addAction( myModuleAction );
+ connect( moduleAction, SIGNAL( moduleActivated( const QString& ) ), this, SLOT( onModuleActivation( const QString& ) ) );
+ createTool( registerAction( ModulesListId, moduleAction ), modTBar );
}
// New window
case 0:
default:
putInfo( tr("INF_CANCELLED") );
- if ( myModuleAction )
- myModuleAction->setActiveModule( QString() );
+
+ LightApp_ModuleAction* moduleAction =
+ qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
+ if ( moduleAction )
+ moduleAction->setActiveModule( QString() );
cancelled = true;
}
}
if ( activeModule() )
modName = activeModule()->moduleName();
- if ( myModuleAction )
- myModuleAction->setActiveModule( modName );
+ LightApp_ModuleAction* moduleAction =
+ qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
+ if ( moduleAction )
+ moduleAction->setActiveModule( modName );
}
/*!
class LightApp_Preferences;
class LightApp_SelectionMgr;
class LightApp_DataObject;
-class LightApp_ModuleAction;
class SUIT_Study;
class SUIT_Accel;
class CAM_Module;
NewQxGraphViewId,
#endif
- PreferencesId, MRUId, UserID };
+ PreferencesId, MRUId, ModulesListId, UserID };
public:
LightApp_Application();
virtual ~LightApp_Application();
protected:
LightApp_Preferences* myPrefs;
LightApp_SelectionMgr* mySelMgr;
- LightApp_ModuleAction* myModuleAction;
WindowMap myWindows;
WindowVisibilityMap myWindowsVisible;