if ( myModule ){
// Connect the module to the active study
- CAM_Study* camStudy = dynamic_cast<CAM_Study*>( activeStudy() );
- if ( camStudy ){
- CAM_DataModel* prev = 0;
- for ( ModuleListIterator it( myModules ); it.current(); ++it ) {
- CAM_DataModel* dm = it.current()->dataModel();
- if ( it.current() == myModule && !camStudy->containsDataModel( dm ) ){
- if ( prev )
- camStudy->insertDataModel( it.current()->dataModel(), prev );
- else
- camStudy->insertDataModel( it.current()->dataModel(), 0 );
- }
- prev = dm;
- }
- }
+ myModule->connectToStudy( dynamic_cast<CAM_Study*>( activeStudy() ) );
if ( !myModule->activateModule( activeStudy() ) )
{
myModule->setMenuShown( false );
{
return QtxActionMgr::separator();
}
+
+/*! Connect data model of module with active study */
+void CAM_Module::connectToStudy( CAM_Study* camStudy )
+{
+ CAM_Application* app = camStudy ? dynamic_cast<CAM_Application*>( camStudy->application() ) : 0;
+ if( !app )
+ return;
+
+ CAM_DataModel* prev = 0;
+ for( CAM_Application::ModuleListIterator it = app->modules(); it.current(); ++it )
+ {
+ CAM_DataModel* dm = it.current()->dataModel();
+ if( it.current() == this && !camStudy->containsDataModel( dm ) )
+ {
+ if( prev )
+ camStudy->insertDataModel( it.current()->dataModel(), prev );
+ else
+ camStudy->insertDataModel( it.current()->dataModel(), 0 );
+ }
+ prev = dm;
+ }
+}
class QAction;
class SUIT_Study;
+class CAM_Study;
class CAM_DataModel;
class CAM_Application;
class QtxActionMenuMgr;
virtual bool activateModule( SUIT_Study* );
virtual bool deactivateModule( SUIT_Study* );
+ virtual void connectToStudy( CAM_Study* );
+
virtual void studyClosed( SUIT_Study* );
virtual void studyChanged( SUIT_Study*, SUIT_Study* );