X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_InputPanel.cxx;h=0049fac767fe8fe0a6300fb991e0f88c1530e04b;hb=fce3f1240b6161d7cb837344078e5943b90eca65;hp=3ece51e833d035ddf097191de5307063ea39eb46;hpb=64b1c61587fc5a975a06821be9e85e524d4dd2e4;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_InputPanel.cxx b/src/HYDROGUI/HYDROGUI_InputPanel.cxx index 3ece51e8..0049fac7 100644 --- a/src/HYDROGUI/HYDROGUI_InputPanel.cxx +++ b/src/HYDROGUI/HYDROGUI_InputPanel.cxx @@ -27,8 +27,10 @@ #include #include #include +#include -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 ); @@ -124,22 +134,57 @@ void HYDROGUI_InputPanel::closeEvent ( QCloseEvent * event ) emit panelCancel(); } +void HYDROGUI_InputPanel::insertWidget( QWidget* theWidget, int theIndex, int theStretch ) +{ + if( mySplitter ) + { + mySplitter->insertWidget( theIndex, theWidget ); + mySplitter->setStretchFactor( theIndex, theStretch ); + } + else + { + QBoxLayout* aMainLayout = dynamic_cast( myMainFrame->layout() ); + aMainLayout->insertWidget( theIndex, theWidget, theStretch ); + } +} + void HYDROGUI_InputPanel::addWidget( QWidget* theWidget, int theStretch ) { - QBoxLayout* aMainLayout = dynamic_cast( myMainFrame->layout() ); - aMainLayout->addWidget( theWidget, theStretch ); + if( mySplitter ) + { + int s = mySplitter->count(); + mySplitter->addWidget( theWidget ); + mySplitter->setStretchFactor( s, theStretch ); + } + else + { + QBoxLayout* aMainLayout = dynamic_cast( myMainFrame->layout() ); + aMainLayout->addWidget( theWidget, theStretch ); + } } -void HYDROGUI_InputPanel::addLayout( QLayout* theLayout ) +void HYDROGUI_InputPanel::addLayout( QLayout* theLayout, int theStretch ) { - QBoxLayout* aMainLayout = dynamic_cast( myMainFrame->layout() ); - aMainLayout->addLayout( theLayout ); + if( mySplitter ) + { + } + else + { + QBoxLayout* aMainLayout = dynamic_cast( myMainFrame->layout() ); + aMainLayout->addLayout( theLayout, theStretch ); + } } void HYDROGUI_InputPanel::addStretch() { - QBoxLayout* aMainLayout = dynamic_cast( myMainFrame->layout() ); - aMainLayout->addStretch(); + if( mySplitter ) + { + } + else + { + QBoxLayout* aMainLayout = dynamic_cast( myMainFrame->layout() ); + aMainLayout->addStretch(); + } } QFrame* HYDROGUI_InputPanel::mainFrame() const @@ -151,3 +196,8 @@ QFrame* HYDROGUI_InputPanel::buttonFrame() const { return myBtnFrame; } + +QSplitter* HYDROGUI_InputPanel::splitter() const +{ + return mySplitter; +}