]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
[MEDCalc] Switch PresentationController visibility on/off when (de)activating modules
authorCédric Aguerre <cedric.aguerre@edf.fr>
Wed, 2 Mar 2016 17:10:21 +0000 (18:10 +0100)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Wed, 2 Mar 2016 17:10:21 +0000 (18:10 +0100)
src/MEDCalc/gui/MEDModule.cxx
src/MEDCalc/gui/PresentationController.cxx
src/MEDCalc/gui/PresentationController.hxx

index d5835444a3e5cf674f7a4312e36752e10585b5e3..3a8848dccd039676e4ee7bd706405d3eacf038de 100644 (file)
@@ -161,6 +161,7 @@ MEDModule::activateModule( SUIT_Study* theStudy )
 
   //this->createStudyComponent(theStudy);
   _workspaceController->showDockWidgets(true);
+  _presentationController->showDockWidgets(true);
   //this->setDockLayout(StandardApp_Module::DOCKLAYOUT_LEFT_VLARGE);
 
   // return the activation status
@@ -171,6 +172,7 @@ bool
 MEDModule::deactivateModule( SUIT_Study* theStudy )
 {
   _workspaceController->showDockWidgets(false);
+  _presentationController->showDockWidgets(false);
   //this->unsetDockLayout();
 
   // hide own menus
index c53281a49b2c21cc82bb0fe9330a7951d24795c5..9a28d60c78d4cd0b01142a95da7c41fa500241a7 100644 (file)
@@ -36,7 +36,6 @@
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
 #include <QMessageBox>
-#include <QDockWidget>
 
 PresentationController::PresentationController(MEDModule* salomeModule)
 {
@@ -47,15 +46,15 @@ PresentationController::PresentationController(MEDModule* salomeModule)
   _widgetPresentationParameters = new WidgetPresentationParameters();
 
   QMainWindow* parent = salomeModule->getApp()->desktop();
-  QDockWidget *dockWidget = new QDockWidget(parent);
-  dockWidget->setVisible(false);
-  dockWidget->setWindowTitle(tr("TITLE_PRESENTATION_PARAMETERS"));
-  dockWidget->setObjectName(tr("TITLE_PRESENTATION_PARAMETERS"));
-  dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
-  dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-  dockWidget->setWidget(_widgetPresentationParameters);
-  parent->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
-  dockWidget->show();
+  _dockWidget = new QDockWidget(parent);
+  _dockWidget->setVisible(false);
+  _dockWidget->setWindowTitle(tr("TITLE_PRESENTATION_PARAMETERS"));
+  _dockWidget->setObjectName(tr("TITLE_PRESENTATION_PARAMETERS"));
+  _dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
+  _dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+  _dockWidget->setWidget(_widgetPresentationParameters);
+  parent->addDockWidget(Qt::LeftDockWidgetArea, _dockWidget);
+  //_dockWidget->show();
 }
 
 PresentationController::~PresentationController()
@@ -254,3 +253,10 @@ PresentationController::processWorkspaceEvent(const MEDCALC::MedEvent* event)
     this->updateTreeViewWithNewPresentation(event->dataId, event->presentationId);
   }
 }
+
+void
+PresentationController::showDockWidgets(bool isVisible)
+{
+  STDLOG("Switching PresentationController visibility to: " << isVisible);
+  _dockWidget->setVisible(isVisible);
+}
index 57f7e46dff65c9422950f81bc4128247d6ba8e04..3d8ada96bf48a8f00dbeeb396ea01fd52f77f35b 100644 (file)
@@ -21,6 +21,7 @@
 #define PRESENTATION_CONTROLLER_HXX
 
 #include <QtGui>
+#include <QDockWidget>
 #include "MEDCALCGUI.hxx"
 
 #include "MEDEventListener_i.hxx"
@@ -59,6 +60,8 @@ public:
   MEDCALC::MEDPresentationViewMode getSelectedViewMode();
   MEDCALC::MEDPresentationColorMap getSelectedColorMap();
 
+  void showDockWidgets(bool isVisible);
+
 signals:
   void presentationSignal(const PresentationEvent*);
 
@@ -79,6 +82,7 @@ private:
 private:
   MEDModule* _salomeModule;
   SALOME_AppStudyEditor* _studyEditor; // borrowed to MEDModule
+  QDockWidget *_dockWidget;
   WidgetPresentationParameters* _widgetPresentationParameters;
 };