]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3250: Adapt a list of parameters to a width of parameter strings
authorvsv <vsv@opencascade.com>
Thu, 14 May 2020 15:47:30 +0000 (18:47 +0300)
committervsv <vsv@opencascade.com>
Thu, 14 May 2020 15:47:30 +0000 (18:47 +0300)
src/ModuleBase/ModuleBase_ParamSpinBox.cpp

index fcfbf29492ff032e510c5d6dc6c697abfe802db6..8107a46a8e33e4282806505d1f95e730977dcb8e 100644 (file)
@@ -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);
 }
 
 /*!