]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Prevent resizing of property panel on an operation launch.
authorvsv <vsv@opencascade.com>
Mon, 27 May 2019 15:01:03 +0000 (18:01 +0300)
committervsv <vsv@opencascade.com>
Mon, 3 Jun 2019 10:32:08 +0000 (13:32 +0300)
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 913d35eef5e7dceb1875ec4838da09c30a727a74..44858157f45c123c9cbf6905c08b6afc61eb02b5 100644 (file)
@@ -727,3 +727,10 @@ void XGUI_ObjectsBrowser::setFoldersState(const QMap<ObjectPtr, bool>& theStates
     myTreeView->setExpanded(aIdx, aIt.value());
   }
 }
+
+
+void XGUI_ObjectsBrowser::resizeEvent(QResizeEvent* theEvent)
+{
+  QWidget::resizeEvent(theEvent);
+  emit sizeChanged();
+}
index 1f43c899ce3a18e7e24a32b828b5e77614117f22..6be4b39da9cb0fa23c4d0d88f10cd46d9d15d6e1 100644 (file)
@@ -237,6 +237,15 @@ signals:
   //! Segnal is emitted when user cliks by mouse in header label of object browser
   void headerMouseDblClicked(const QModelIndex&);
 
+  //! An signal emitted on resize of the Object Browser
+  void sizeChanged();
+
+
+protected:
+  //! redefinition of a virtual method
+  void resizeEvent(QResizeEvent* theEvent);
+
+
  private slots:
   /// Show context menu
   /// \param theEvent a context menu event
index b4a0eb3b18dc4c9c5a4966b4815137250c956531..d54412c59160a87956b0e651b969fcd5c6a1bbf4 100644 (file)
@@ -1394,8 +1394,7 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
 {
   QDockWidget* aObjDock = new QDockWidget(theParent);
   aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea |
-                            Qt::RightDockWidgetArea |
-                            Qt::BottomDockWidgetArea);
+                            Qt::RightDockWidgetArea);
   aObjDock->setWindowTitle(tr("Object browser"));
   aObjDock->setStyleSheet(
       "::title { position: relative; padding-left: 5px; text-align: left center }");
@@ -1404,6 +1403,8 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
   myModule->customizeObjectBrowser(myObjectBrowser);
   aObjDock->setWidget(myObjectBrowser);
 
+  connect(myObjectBrowser, SIGNAL(sizeChanged()), SLOT(onDockSizeChanged()));
+
   myContextMenuMgr->connectObjectBrowser();
   return aObjDock;
 }
@@ -1423,9 +1424,9 @@ void XGUI_Workshop::createDockWidgets()
 
   myPropertyPanel->setupActions(myActionsMgr);
   myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
-                                   Qt::RightDockWidgetArea |
-                                   Qt::BottomDockWidgetArea);
+                                   Qt::RightDockWidgetArea);
   aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
+
   hidePanel(myPropertyPanel);  ///<! Invisible by default
 
   myFacesPanel = new XGUI_FacesPanel(aDesktop, myModuleConnector);
@@ -2917,4 +2918,19 @@ void XGUI_Workshop::clearTemporaryDir()
       aDir.remove(aFile);
     }
   }
-}
\ No newline at end of file
+}
+
+
+void XGUI_Workshop::onDockSizeChanged()
+{
+  QDockWidget* aDockWgt = dynamic_cast<QDockWidget*>(myObjectBrowser->parentWidget());
+  int aObWidth = aDockWgt->size().width();
+  if (myPropertyPanel->width() != aObWidth) {
+    QList<QDockWidget*> aWgtList;
+    aWgtList << myPropertyPanel << aDockWgt;
+    QList<int> aSizeList;
+    aSizeList << aObWidth << aObWidth;
+    desktop()->resizeDocks(aWgtList, aSizeList, Qt::Horizontal);
+    disconnect(myObjectBrowser, SIGNAL(sizeChanged()), this, SLOT(onDockSizeChanged()));
+  }
+}
index 01c75a373b0fd2697bb04a8b573d50d8dba62e77..e7da8532dcd743467b9c989041ec890d42d66be9 100644 (file)
@@ -477,6 +477,9 @@ private:
   /// Called on help button clicked in the property panel.
   void onHelpActionClicked();
 
+  //! The slot is called only once on resizing of Object Browser
+  void onDockSizeChanged();
+
  private:
   /// Init menu
   void initMenu();