]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1332: implementation of the splitter
authorasl <asl@opencascade.com>
Wed, 27 Sep 2017 14:38:19 +0000 (17:38 +0300)
committerasl <asl@opencascade.com>
Wed, 27 Sep 2017 14:38:19 +0000 (17:38 +0300)
src/HYDROGUI/HYDROGUI_InputPanel.cxx
src/HYDROGUI/HYDROGUI_InputPanel.h
src/HYDROGUI/HYDROGUI_ProfileDlg.cxx
src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx
src/HYDROGUI/HYDROGUI_ViewerDlg.cxx
src/HYDROGUI/HYDROGUI_ViewerDlg.h

index 2c058db34d2c51fd795f034c1fcce0ac8b8cd34c..0049fac767fe8fe0a6300fb991e0f88c1530e04b 100644 (file)
 #include <QLayout>
 #include <QPushButton>
 #include <QDir>
+#include <QSplitter>
 
-HYDROGUI_InputPanel::HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QString& theTitle, bool doInitLayout )
+HYDROGUI_InputPanel::HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QString& theTitle,
+                                          bool doInitLayout, bool isSplitter )
 #ifdef LIGHT_MODE
 : QDockWidget( 0 ),
 #else
@@ -49,6 +51,14 @@ HYDROGUI_InputPanel::HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QStr
   QBoxLayout* aMainLayout = new QVBoxLayout( myMainFrame );
   aMainLayout->setMargin( 0 );
   aMainLayout->setSpacing( 5 );
+  if( isSplitter )
+  {
+    mySplitter = new QSplitter( myMainFrame );
+    mySplitter->setOrientation( Qt::Vertical );
+    aMainLayout->addWidget( mySplitter, 1 );
+  }
+  else
+    mySplitter = 0;
     
   aLayout->addWidget( myMainFrame, 1 );
 
@@ -126,26 +136,55 @@ void HYDROGUI_InputPanel::closeEvent ( QCloseEvent * event )
 
 void HYDROGUI_InputPanel::insertWidget( QWidget* theWidget, int theIndex, int theStretch )
 {
-  QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
-  aMainLayout->insertWidget( theIndex, theWidget, theStretch );
+  if( mySplitter )
+  {
+    mySplitter->insertWidget( theIndex, theWidget );
+    mySplitter->setStretchFactor( theIndex, theStretch );
+  }
+  else
+  {
+    QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
+    aMainLayout->insertWidget( theIndex, theWidget, theStretch );
+  }
 }
 
 void HYDROGUI_InputPanel::addWidget( QWidget* theWidget, int theStretch )
 {
-  QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
-  aMainLayout->addWidget( theWidget, theStretch );
+  if( mySplitter )
+  {
+    int s = mySplitter->count();
+    mySplitter->addWidget( theWidget );
+    mySplitter->setStretchFactor( s, theStretch );
+  }
+  else
+  {
+    QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
+    aMainLayout->addWidget( theWidget, theStretch );
+  }
 }
 
 void HYDROGUI_InputPanel::addLayout( QLayout* theLayout, int theStretch )
 {
-  QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
-  aMainLayout->addLayout( theLayout, theStretch );
+  if( mySplitter )
+  {
+  }
+  else
+  {
+    QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
+    aMainLayout->addLayout( theLayout, theStretch );
+  }
 }
 
 void HYDROGUI_InputPanel::addStretch()
 {
-  QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
-  aMainLayout->addStretch();
+  if( mySplitter )
+  {
+  }
+  else
+  {
+    QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
+    aMainLayout->addStretch();
+  }
 }
 
 QFrame* HYDROGUI_InputPanel::mainFrame() const
@@ -157,3 +196,8 @@ QFrame* HYDROGUI_InputPanel::buttonFrame() const
 {
   return myBtnFrame;
 }
+
+QSplitter* HYDROGUI_InputPanel::splitter() const
+{
+  return mySplitter;
+}
index 351b3cdc6a5d18499a369935bc9a0602ef31ac5b..e5093afa428afceff6e577a11d6c3f81832b3f4c 100644 (file)
@@ -25,6 +25,7 @@ class QFrame;
 class QPushButton;
 class QLayout;
 class QCloseEvent;
+class QSplitter;
 
 class HYDROGUI_Module;
 
@@ -36,7 +37,7 @@ class HYDROGUI_InputPanel : public QDockWidget
   Q_OBJECT
 
 public:
-  HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QString& theTitle, bool doInitLayout = true );
+  HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QString& theTitle, bool doInitLayout = true, bool isSplitter = false );
   virtual ~HYDROGUI_InputPanel();
 
   void addWidget( QWidget* theWidget, int theStretch = 0 );
@@ -66,6 +67,8 @@ protected:
   QFrame*         buttonFrame() const;
   virtual void    closeEvent ( QCloseEvent * event );
 
+  QSplitter* splitter() const;
+
   QPushButton* myCancel;
   QPushButton* myHelp;
 
@@ -75,6 +78,7 @@ private:
   QFrame* myBtnFrame;
   QPushButton* myApplyAndClose;
   QPushButton* myApply;
+  QSplitter* mySplitter;
 };
 
 #endif
index 98767efd651984ad9bddac0f88c88eb030672054..3f7c8b6ccebfee277536ec6cbb5177b91821d8c1 100644 (file)
@@ -42,7 +42,7 @@
 #include <QMouseEvent>
 
 HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-: HYDROGUI_ViewerDlg( theModule, theTitle ),
+: HYDROGUI_ViewerDlg( theModule, theTitle, true ),
   myName( NULL )
 {
   QFrame* name_frame = new QFrame( mainFrame() );
@@ -53,7 +53,7 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr
   myName = new QLineEdit(this);
   name_layout->addWidget(myName);
 
-  insertWidget( name_frame, 0, 0);
+  insertWidget( name_frame, 0, 0 );
 
   int anActionFlags = 
     CurveCreator_Widget::DisableNewSection | CurveCreator_Widget::DisableDetectionMode |
index 70b3a7e206905f4eef981a971a56a18b3ca3780c..fe3f1beb58e6cd8277a53703176a2ab5d9ff7344 100644 (file)
@@ -45,7 +45,7 @@
 #include <HYDROData_Profile.h>
 
 HYDROGUI_ProfileInterpolateDlg::HYDROGUI_ProfileInterpolateDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-    : HYDROGUI_ViewerDlg( theModule, theTitle )
+    : HYDROGUI_ViewerDlg( theModule, theTitle, false )
 {
     QWidget* main = new QGroupBox( mainFrame() );
     QGridLayout* base = new QGridLayout( main );
index 1a8a6c361e2999037a42efb7eb33cdd09f8e3cb3..4465443d7e021a3eccc50add81e3ec92ac94b575 100644 (file)
@@ -43,8 +43,8 @@
 #include <QLineEdit>
 #include <QMouseEvent>
 
-HYDROGUI_ViewerDlg::HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-: HYDROGUI_InputPanel( theModule, theTitle )
+HYDROGUI_ViewerDlg::HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QString& theTitle, bool isSplitter )
+: HYDROGUI_InputPanel( theModule, theTitle, true, isSplitter )
 {
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
   myViewManager = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
@@ -109,7 +109,7 @@ bool HYDROGUI_ViewerDlg::event( QEvent* e )
 {
     if ( e->type() == QEvent::Polish )
     {
-        addWidget( myCoordLabel->parentWidget(), 4 );
+        //addWidget( myCoordLabel->parentWidget(), 4 );
 
         Handle(AIS_Trihedron) aTrihedron = trihedron();
         Handle(AIS_InteractiveContext) anAISContext = getAISContext();
index a638b06be9e40f3d84f8f6df89c15b81c108b3fd..0f5ed4b99ba91d3e47a5888808231fc71bc18bdf 100644 (file)
@@ -37,7 +37,7 @@ class HYDROGUI_ViewerDlg : public HYDROGUI_InputPanel
   Q_OBJECT
 
 public:
-  HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QString& theTitle, bool isSplitter );
   virtual ~HYDROGUI_ViewerDlg();
 
   Handle(AIS_InteractiveContext) getAISContext();