]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2582: Restore state of Inspection panel for a one session
authorvsv <vsv@opencascade.com>
Tue, 2 Oct 2018 16:30:43 +0000 (19:30 +0300)
committervsv <vsv@opencascade.com>
Tue, 2 Oct 2018 16:31:00 +0000 (19:31 +0300)
src/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/SHAPERGUI.h

index 50ca7585f762de2a0cc5de11f48b8208235b01d1..dae608ae7a139b3db25694c4b8fdac0a7309ded9 100644 (file)
@@ -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
index 1c0a10ee70fa38c24e7709c9724b0cdcf594a5a8..1241ebc75d0c90a38b78c4cb797fa5260697c0e6 100644 (file)
@@ -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