From 4530bb5d47e49f536e6e4e3159fcea6f6705548c Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 2 Oct 2018 19:30:43 +0300 Subject: [PATCH] Issue #2582: Restore state of Inspection panel for a one session --- src/SHAPERGUI/SHAPERGUI.cpp | 33 +++++++++++++++++++-------------- src/SHAPERGUI/SHAPERGUI.h | 6 ++++++ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 50ca7585f..dae608ae7 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -121,7 +121,8 @@ private: //****************************************************** SHAPERGUI::SHAPERGUI() : LightApp_Module("SHAPER"), - mySelector(0), myIsOpened(0), myPopupMgr(0) + mySelector(0), myIsOpened(0), myPopupMgr(0), myIsInspectionVisible(false), + myInspectionPanel(0) { myWorkshop = new XGUI_Workshop(this); connect(myWorkshop, SIGNAL(commandStatusUpdated()), @@ -224,12 +225,12 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) desktop()->tabifyDockWidget(aObjDoc, myWorkshop->propertyPanel()); } - QDockWidget* aInspection = myWorkshop->inspectionPanel(); - if (aInspection) { - QAction* aViewAct = aInspection->toggleViewAction(); - aViewAct->setEnabled(true); + if (!myInspectionPanel) { + myInspectionPanel = myWorkshop->inspectionPanel(); + QAction* aViewAct = myInspectionPanel->toggleViewAction(); connect(aViewAct, SIGNAL(toggled(bool)), this, SLOT(onWhatIs(bool))); } + myInspectionPanel->toggleViewAction()->setEnabled(true); if (!mySelector) { ViewManagerList OCCViewManagers; @@ -330,12 +331,10 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) QAction* aViewAct = aObjDoc->toggleViewAction(); aViewAct->setEnabled(false); } - QDockWidget* aInspection = myWorkshop->inspectionPanel(); - if (aInspection) { - aInspection->setVisible(false); - QAction* aViewAct = aInspection->toggleViewAction(); - aViewAct->setEnabled(false); - } + + myIsInspectionVisible = myInspectionPanel->isVisible(); + QAction* aViewAct = myInspectionPanel->toggleViewAction(); + aViewAct->setEnabled(false); // the active operation should be stopped for the next activation. // There should not be active operation and visualized preview. @@ -770,17 +769,23 @@ void SHAPERGUI::createFeatureActions() void SHAPERGUI::onWhatIs(bool isToggled) { - QDockWidget* aInspection = myWorkshop->inspectionPanel(); if (sender() == myWhatIsAction) { - QAction* aViewAct = aInspection->toggleViewAction(); + QAction* aViewAct = myInspectionPanel->toggleViewAction(); aViewAct->blockSignals(true); aViewAct->setChecked(isToggled); aViewAct->blockSignals(false); - aInspection->setVisible(isToggled); + myInspectionPanel->setVisible(isToggled); } else { myWhatIsAction->blockSignals(true); myWhatIsAction->setChecked(isToggled); myWhatIsAction->blockSignals(false); + myInspectionPanel->setVisible(isToggled); } +} + +void SHAPERGUI::updateModuleVisibilityState() +{ + LightApp_Module::updateModuleVisibilityState(); + onWhatIs(myIsInspectionVisible); } \ No newline at end of file diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index 1c0a10ee7..1241ebc75 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -154,6 +154,8 @@ Q_OBJECT /// \brief Set flag about opened document state void setIsOpened(bool theOpened) { myIsOpened = theOpened; } + virtual void updateModuleVisibilityState(); + public slots: /// \brief The method is redefined to connect to the study viewer before the data /// model is filled by opened file. This file open will flush redisplay signals for, @@ -243,6 +245,10 @@ private slots: QtxPopupMgr* myPopupMgr; QAction* myWhatIsAction; + + bool myIsInspectionVisible; + QDockWidget* myInspectionPanel; + }; #endif -- 2.39.2