Spin box: fix input of double values in locales with non-point decimal separator

This commit is contained in:
Martin Dobias 2017-10-12 15:23:56 +02:00
parent 54f8825350
commit c176a8bfb0

View File

@ -471,7 +471,9 @@ double QgsExpression::evaluateToDouble( const QString &text, const double fallba
{ {
bool ok; bool ok;
//first test if text is directly convertible to double //first test if text is directly convertible to double
double convertedValue = text.toDouble( &ok ); // use system locale: e.g. in German locale, user is presented with numbers "1,23" instead of "1.23" in C locale
// so we also want to allow user to rewrite it to "5,23" and it is still accepted
double convertedValue = QLocale::system().toDouble( text, &ok );
if ( ok ) if ( ok )
{ {
return convertedValue; return convertedValue;