From edd147c13cbe1c41515421277b2fd9fb61c4ec17 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 15 Oct 2010 07:42:29 +0000 Subject: [PATCH] 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. --- src/CAM/CAM_Module.cxx | 15 ++++++++++++++- src/CAM/CAM_Module.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) 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(); -- 2.39.2