From: adv Date: Fri, 15 Oct 2010 07:42:29 +0000 (+0000) Subject: New method setApplication added. This is used e.g. when a module instance is created... X-Git-Tag: V5_1_10~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=edd147c13cbe1c41515421277b2fd9fb61c4ec17;p=modules%2Fgui.git New method setApplication added. This is used e.g. when a module instance is created but not intialized by custom application class,still the module needs some minimal link to application. --- diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index d3dde1a21..580cf5948 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -91,7 +91,7 @@ CAM_Module::~CAM_Module() */ void CAM_Module::initialize( CAM_Application* app ) { - myApp = app; + setApplication( app ); if ( myApp ) { SUIT_Session* aSession = SUIT_Session::session(); @@ -101,6 +101,19 @@ void CAM_Module::initialize( CAM_Application* app ) connect( myApp, SIGNAL( infoChanged( QString ) ), this, SLOT( onInfoChanged( QString ) ) ); } } +/*! + \brief Sets the application instance that owns this module. + + This protected method allows derived module classes to set application object + from methods different from initalize(). This is used e.g. when + a module instance is created but not intialized by custom application class, + still the module needs some minimal link to application. + \sa initialize() +*/ +void CAM_Module::setApplication( CAM_Application* app ) +{ + myApp = app; +} /*! \brief Get module icon. diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h index 628623f11..f9aec9769 100755 --- a/src/CAM/CAM_Module.h +++ b/src/CAM/CAM_Module.h @@ -94,6 +94,7 @@ private slots: void onInfoChanged( QString ); protected: + virtual void setApplication( CAM_Application* ); virtual bool isSelectionCompatible(); virtual CAM_DataModel* createDataModel();