From e1bdaa9fb418f0c0313191af55861ecc003f7d27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Wed, 2 Mar 2016 18:10:21 +0100 Subject: [PATCH] [MEDCalc] Switch PresentationController visibility on/off when (de)activating modules --- src/MEDCalc/gui/MEDModule.cxx | 2 ++ src/MEDCalc/gui/PresentationController.cxx | 26 +++++++++++++--------- src/MEDCalc/gui/PresentationController.hxx | 4 ++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/MEDCalc/gui/MEDModule.cxx b/src/MEDCalc/gui/MEDModule.cxx index d5835444a..3a8848dcc 100644 --- a/src/MEDCalc/gui/MEDModule.cxx +++ b/src/MEDCalc/gui/MEDModule.cxx @@ -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 diff --git a/src/MEDCalc/gui/PresentationController.cxx b/src/MEDCalc/gui/PresentationController.cxx index c53281a49..9a28d60c7 100644 --- a/src/MEDCalc/gui/PresentationController.cxx +++ b/src/MEDCalc/gui/PresentationController.cxx @@ -36,7 +36,6 @@ #include #include #include -#include 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); +} diff --git a/src/MEDCalc/gui/PresentationController.hxx b/src/MEDCalc/gui/PresentationController.hxx index 57f7e46df..3d8ada96b 100644 --- a/src/MEDCalc/gui/PresentationController.hxx +++ b/src/MEDCalc/gui/PresentationController.hxx @@ -21,6 +21,7 @@ #define PRESENTATION_CONTROLLER_HXX #include +#include #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; }; -- 2.39.2