X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ParamSpinBox.cpp;h=9c9cc761329f1a34dc7c03becabc4e3864fabac0;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=941a2e2cf0e359990ca18a23077d957e37e602b7;hpb=bfc21d599161eb7789ca4134ebcc7be4aeee25b2;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index 941a2e2cf..9c9cc7613 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 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 @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "ModuleBase_ParamSpinBox.h" @@ -48,9 +47,9 @@ ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox(QWidget* theParent, int thePrec : 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()); @@ -82,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); } /*! @@ -162,7 +172,6 @@ void ModuleBase_ParamSpinBox::setValue(double value) double ModuleBase_ParamSpinBox::value() const { - std::string aa = lineEdit()->text().toStdString(); return lineEdit()->text().toDouble(); }