]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #611: minimum size for list widget is decreased
authorasl <asl@opencascade.com>
Fri, 14 Aug 2015 08:59:49 +0000 (11:59 +0300)
committerasl <asl@opencascade.com>
Fri, 14 Aug 2015 08:59:49 +0000 (11:59 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp

index faaaebdba4cc4861611023456908e9000536d652..3425faca913f54964e9e14af3f8b2d36a3f33bef 100644 (file)
 
 //#define DEBUG_SHAPE_VALIDATION_PREVIOUS
 
+class CustomListWidget : public QListWidget
+{
+public:
+  CustomListWidget( QWidget* theParent )
+    : QListWidget( theParent )
+  {
+  }
+
+  virtual QSize        sizeHint() const
+  {
+    int aHeight = 2*QFontMetrics( font() ).height();
+    QSize aSize = QListWidget::sizeHint();
+    return QSize( aSize.width(), aHeight );
+  }
+
+  virtual QSize        minimumSizeHint() const
+  {
+    int aHeight = 2*QFontMetrics( font() ).height();
+    QSize aSize = QListWidget::minimumSizeHint();
+    return QSize( aSize.width(), aHeight );
+  }
+};
+
 ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParent,
                                                                ModuleBase_IWorkshop* theWorkshop,
                                                                const Config_WidgetAPI* theData,
@@ -82,12 +105,12 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
     aMainLay->setColumnStretch(2, 1);
   }
 
-  myListControl = new QListWidget(this);
-  aMainLay->addWidget(myListControl, 2, 0, 2, -1);
+  myListControl = new CustomListWidget(this);
+  aMainLay->addWidget(myListControl, 2, 0, 1, -1);
   aMainLay->setRowStretch(2, 1);
-  aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
-  aMainLay->setRowMinimumHeight(3, 20);
-  this->setLayout(aMainLay);
+  //aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
+  //aMainLay->setRowMinimumHeight(3, 20);
+  //this->setLayout(aMainLay);
   connect(myTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectionTypeChanged()));
 
   myCopyAction = new QAction(QIcon(":pictures/copy.png"), tr("Copy"), this);