From: vsv Date: Thu, 14 May 2020 15:47:30 +0000 (+0300) Subject: Issue #3250: Adapt a list of parameters to a width of parameter strings X-Git-Tag: V9_5_0b1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a095ac534ad8c9f38329fee601c9dc397e273fe6;p=modules%2Fshaper.git Issue #3250: Adapt a list of parameters to a width of parameter strings --- diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index fcfbf2949..8107a46a8 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -81,6 +81,17 @@ void ModuleBase_ParamSpinBox::setCompletionList(QStringList& theList) theList.removeDuplicates(); theList.sort(); myCompleterModel->setStringList(theList); + + QAbstractItemView* aPopup = myCompleter->popup(); + QFontMetrics aMetric = aPopup->fontMetrics(); + int aWidth = 0; + QRect aRect; + foreach(QString aStr, theList) { + aRect = aMetric.boundingRect(aStr); + if (aRect.width() > aWidth) + aWidth = aRect.width(); + } + aPopup->setMinimumWidth(aWidth + 25); } /*!