]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Add a scroll when needed
authorvsr <vsr@opencascade.com>
Mon, 23 Nov 2020 17:37:19 +0000 (20:37 +0300)
committervsr <vsr@opencascade.com>
Mon, 23 Nov 2020 17:37:19 +0000 (20:37 +0300)
src/Qtx/QtxInfoPanel.cxx

index c90adb3e85031a354a0a4605a794341d185d875f..cf809f67519d120e23c9d403cb6c940a41b2a422 100644 (file)
@@ -31,6 +31,7 @@
 #include <QSizePolicy>
 #include <QToolButton>
 #include <QVBoxLayout>
+#include <QScrollArea>
 
 /*!
   \class QtxInfoPanel::Container
@@ -191,11 +192,27 @@ QtxInfoPanel::QtxInfoPanel( QWidget* parent )
 {
   title = new Title( this );
   container = new Container( this );
+
   QVBoxLayout* layout = new QVBoxLayout( this );
-  layout->setMargin( 0 );
+  layout->setContentsMargins( 0, 0, 0, 0 );
+
+  QWidget* wg = new QWidget();
+  QVBoxLayout* wg_layout = new QVBoxLayout( wg );
+  wg_layout->setContentsMargins( 0, 0, 0, 0 );
+  wg_layout->addWidget( container );
+  wg_layout->addStretch();
+  
+  QScrollArea* scroll = new QScrollArea();
+  scroll->setWidgetResizable( true );
+  scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
+  scroll->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding );
+  scroll->setSizeAdjustPolicy( QScrollArea::AdjustToContents );
+  scroll->setFrameStyle( QScrollArea::NoFrame );
+  scroll->setContentsMargins( 0, 0, 0, 0 );
+  scroll->setWidget( wg );
+  
   layout->addWidget( title );
-  layout->addWidget( container );
-  layout->addStretch();
+  layout->addWidget( scroll );
   setTitle( "" );
 }