return 0;
LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mod_name ) : 0 );
+ bool wasLoaded = false;
if( !m && load )
{
m = dynamic_cast<LightApp_Module*>( app->loadModule( mod_name, false ) );
- if( m )
+ if( m ) {
app->addModule( m );
+ wasLoaded = true;
+ }
}
if( m )
{
m->connectToStudy( dynamic_cast<CAM_Study*>( app->activeStudy() ) );
+ if( wasLoaded )
+ m->updateModuleVisibilityState();
}
return m ? m->displayer() : 0;
}
if (!myIsFirstActivate)
return state;
- myIsFirstActivate = false;
-
- // update visibility state of objects
- SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(application());
- if (!app)
- return false;
-
- SUIT_DataBrowser* ob = app->objectBrowser();
- if (!ob || !ob->model())
- return false;
-
- // connect to click on item
- connect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
- this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ), Qt::UniqueConnection );
-
+ updateModuleVisibilityState();
- SUIT_DataObject* rootObj = ob->root();
- if( !rootObj )
- return false;
-
- DataObjectList listObj = rootObj->children( true );
-
- SUIT_ViewModel* vmod = 0;
- if ( SUIT_ViewManager* vman = app->activeViewManager() )
- vmod = vman->getViewModel();
- app->updateVisibilityState( listObj, vmod );
+ myIsFirstActivate = false;
return state;
}
}
return true;
}
+
+void SalomeApp_Module::updateModuleVisibilityState() {
+
+ // update visibility state of objects
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+ if (!app)
+ return;
+
+ SUIT_DataBrowser* ob = app->objectBrowser();
+ if (!ob || !ob->model())
+ return;
+
+ // connect to click on item
+ connect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
+ this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ), Qt::UniqueConnection );
+
+ SUIT_DataObject* rootObj = ob->root();
+ if( !rootObj )
+ return;
+
+ DataObjectList listObj = rootObj->children( true );
+
+ SUIT_ViewModel* vmod = 0;
+ if ( SUIT_ViewManager* vman = app->activeViewManager() )
+ vmod = vman->getViewModel();
+ app->updateVisibilityState( listObj, vmod );
+}
\ No newline at end of file