Skip to content
Permalink
Browse files

Use system locale for number representation

  • Loading branch information
m-kuhn committed May 3, 2018
1 parent b0d5506 commit 88f36cd9525fe44a72fab474396591c6119c0ad0
Showing with 3 additions and 14 deletions.
  1. +3 −13 src/core/fieldformatter/qgsrangefieldformatter.cpp
  2. +0 −1 src/gui/editorwidgets/qgsdoublespinbox.cpp
@@ -40,16 +40,6 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field

QString result;

// Prepare locale
std::function<QLocale()> f_locale = [ ]
{
QLocale locale( QgsApplication::instance()->locale() );
QLocale::NumberOptions options( locale.numberOptions() );
options |= QLocale::NumberOption::OmitGroupSeparator;
locale.setNumberOptions( options );
return locale;
};

const QgsField field = layer->fields().at( fieldIndex );

if ( field.type() == QVariant::Double &&
@@ -64,7 +54,7 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field
if ( ok )
{
// TODO: make the format configurable!
result = f_locale().toString( val, 'f', precision );
result = QLocale::system().toString( val, 'f', precision );
}
}
}
@@ -75,7 +65,7 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field
double val( value.toInt( &ok ) );
if ( ok )
{
result = f_locale().toString( val, 'f', 0 );
result = QLocale::system().toString( val, 'f', 0 );
}
}
else if ( ( field.type() == QVariant::LongLong ) &&
@@ -85,7 +75,7 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field
double val( value.toLongLong( &ok ) );
if ( ok )
{
result = f_locale().toString( val, 'f', 0 );
result = QLocale::system().toString( val, 'f', 0 );
}
}
else
@@ -32,7 +32,6 @@ QgsDoubleSpinBox::QgsDoubleSpinBox( QWidget *parent )
mLineEdit = new QgsSpinBoxLineEdit();

// By default, group separator is off
setLocale( QLocale( QgsApplication::locale( ) ) );
setLineEdit( mLineEdit );

QSize msz = minimumSizeHint();

0 comments on commit 88f36cd

Please sign in to comment.
You can’t perform that action at this time.