X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_DoubleSpinBox.cpp;h=d85ad9897385d7a1d21529881b9a0180782247d7;hb=28c90c232ffe159b88edd156286a398bfa3bb73b;hp=171e1e849f64cc2c89407c3e7121526436f0f0dd;hpb=4021ee9a0bbca04e0d2db98efa55eff30f03985a;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp index 171e1e849..d85ad9897 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp @@ -62,11 +62,13 @@ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* parent, int thePreci loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator); setLocale(loc); + // MPV 15/09/2014: this must be set before setDecimals; otherwise in release mode setDecimals may crash + myPrecision = thePrecision; + // Use precision equal to default Qt decimals // it's necessary to set decimals before the range setting, // by default Qt rounds boundaries to 2 decimals at setRange setDecimals(thePrecision); - myPrecision = thePrecision; connect(lineEdit(), SIGNAL(textChanged( const QString& )), this, SLOT(onTextChanged( const QString& ))); @@ -244,7 +246,7 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con if (overhead == 0) state = v.validate(str, pos); else { - if (str.length() >= overhead && str.startsWith(pref) && str.right(suff.length()) == suff) { + if ((uint)(str.length()) >= overhead && str.startsWith(pref) && str.right(suff.length()) == suff) { QString core = str.mid(pref.length(), str.length() - overhead); int corePos = pos - pref.length(); state = v.validate(core, corePos);