-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
: QAbstractSpinBox(theParent),
myIsEquation(false),
myAcceptVariables(true),
- mySingleStep(1),
myMinimum(-DBL_MAX),
- myMaximum(DBL_MAX)
+ myMaximum(DBL_MAX),
+ mySingleStep(1)
{
myCompleter = new QCompleter(this);
myCompleter->setWidget(lineEdit());
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);
}
/*!