From: asl Date: Fri, 14 Aug 2015 08:59:49 +0000 (+0300) Subject: Issue #611: minimum size for list widget is decreased X-Git-Tag: V_1.4.0_beta4~377 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9cf84f19759d034caeb443850215f36605cbe08b;p=modules%2Fshaper.git Issue #611: minimum size for list widget is decreased --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index faaaebdba..3425faca9 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -38,6 +38,29 @@ //#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);