From: mpv Date: Thu, 11 Jun 2020 13:39:49 +0000 (+0300) Subject: Fix for the issue when the SHAPER module data model was not correctly initialized... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=38a5f9e3c861f946921f7020073a4b7a4fc47d49;p=modules%2Fgui.git Fix for the issue when the SHAPER module data model was not correctly initialized after a first activation/deactivation, close study and load script. --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 6440bbf1f..983648dcf 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -4970,9 +4970,16 @@ void LightApp_Application::onDesktopMessage( const QString& message ) mod = loadModule(moduleTitle(moduleName)); if (mod) { addModule(mod); - CAM_Study* anActiveStudy = dynamic_cast(activeStudy()); - if (anActiveStudy) - mod->connectToStudy(anActiveStudy); + } + } + if (mod) { + CAM_Study* anActiveStudy = dynamic_cast(activeStudy()); + if (anActiveStudy) { + mod->connectToStudy(anActiveStudy); + LightApp_DataModel* aDM = dynamic_cast(mod->dataModel()); + if(aDM) { + aDM->initRootObject(); + } } } } diff --git a/src/LightApp/LightApp_DataModel.h b/src/LightApp/LightApp_DataModel.h index aec64368b..74016ab3e 100644 --- a/src/LightApp/LightApp_DataModel.h +++ b/src/LightApp/LightApp_DataModel.h @@ -70,6 +70,9 @@ public: int groupId() const; void registerColumn( SUIT_DataBrowser*, const QString&, const int ); void unregisterColumn( SUIT_DataBrowser*, const QString& ); + //! For initialization of the data model and registration of SComponent when study is created + //! but module was not activated. + virtual void initRootObject() {}; signals: void opened();