Skip to content

Commit 88f36cd

Browse files
committed
Use system locale for number representation
1 parent b0d5506 commit 88f36cd

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/core/fieldformatter/qgsrangefieldformatter.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field
4040

4141
QString result;
4242

43-
// Prepare locale
44-
std::function<QLocale()> f_locale = [ ]
45-
{
46-
QLocale locale( QgsApplication::instance()->locale() );
47-
QLocale::NumberOptions options( locale.numberOptions() );
48-
options |= QLocale::NumberOption::OmitGroupSeparator;
49-
locale.setNumberOptions( options );
50-
return locale;
51-
};
52-
5343
const QgsField field = layer->fields().at( fieldIndex );
5444

5545
if ( field.type() == QVariant::Double &&
@@ -64,7 +54,7 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field
6454
if ( ok )
6555
{
6656
// TODO: make the format configurable!
67-
result = f_locale().toString( val, 'f', precision );
57+
result = QLocale::system().toString( val, 'f', precision );
6858
}
6959
}
7060
}
@@ -75,7 +65,7 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field
7565
double val( value.toInt( &ok ) );
7666
if ( ok )
7767
{
78-
result = f_locale().toString( val, 'f', 0 );
68+
result = QLocale::system().toString( val, 'f', 0 );
7969
}
8070
}
8171
else if ( ( field.type() == QVariant::LongLong ) &&
@@ -85,7 +75,7 @@ QString QgsRangeFieldFormatter::representValue( QgsVectorLayer *layer, int field
8575
double val( value.toLongLong( &ok ) );
8676
if ( ok )
8777
{
88-
result = f_locale().toString( val, 'f', 0 );
78+
result = QLocale::system().toString( val, 'f', 0 );
8979
}
9080
}
9181
else

src/gui/editorwidgets/qgsdoublespinbox.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ QgsDoubleSpinBox::QgsDoubleSpinBox( QWidget *parent )
3232
mLineEdit = new QgsSpinBoxLineEdit();
3333

3434
// By default, group separator is off
35-
setLocale( QLocale( QgsApplication::locale( ) ) );
3635
setLineEdit( mLineEdit );
3736

3837
QSize msz = minimumSizeHint();

0 commit comments

Comments
 (0)