Skip to content
Permalink
Browse files

Merge pull request #7764 from elpaso/locale-graduated-renderer

Use QLocale for categorized renderer range
  • Loading branch information
elpaso committed Sep 1, 2018
2 parents b55ab2e + e40b855 commit ba4fb6507264ef8e6a11f20586a64cf7ed1f6503
@@ -228,7 +228,7 @@ QString QgsRendererRangeLabelFormat::formatNumber( double value ) const
{
if ( mPrecision > 0 )
{
QString valueStr = QString::number( value, 'f', mPrecision );
QString valueStr = QLocale().toString( value, 'f', mPrecision );
if ( mTrimTrailingZeroes )
valueStr = valueStr.remove( mReTrailingZeroes );
if ( mReNegativeZero.exactMatch( valueStr ) )
@@ -237,7 +237,7 @@ QString QgsRendererRangeLabelFormat::formatNumber( double value ) const
}
else
{
QString valueStr = QString::number( value * mNumberScale, 'f', 0 );
QString valueStr = QLocale().toString( value * mNumberScale, 'f', 0 );
if ( valueStr == QLatin1String( "-0" ) )
valueStr = '0';
if ( valueStr != QLatin1String( "0" ) )
@@ -152,7 +152,7 @@ QVariant QgsGraduatedSymbolRendererModel::data( const QModelIndex &index, int ro
{
int decimalPlaces = mRenderer->labelFormat().precision() + 2;
if ( decimalPlaces < 0 ) decimalPlaces = 0;
return QString::number( range.lowerValue(), 'f', decimalPlaces ) + " - " + QString::number( range.upperValue(), 'f', decimalPlaces );
return QLocale().toString( range.lowerValue(), 'f', decimalPlaces ) + " - " + QLocale().toString( range.upperValue(), 'f', decimalPlaces );
}
case 2:
return range.label();
@@ -1008,8 +1008,8 @@ void QgsGraduatedSymbolRendererWidget::changeRange( int rangeIdx )
// Ensures users can see if legend is not completely honest!
int decimalPlaces = mRenderer->labelFormat().precision() + 2;
if ( decimalPlaces < 0 ) decimalPlaces = 0;
dialog.setLowerValue( QString::number( range.lowerValue(), 'f', decimalPlaces ) );
dialog.setUpperValue( QString::number( range.upperValue(), 'f', decimalPlaces ) );
dialog.setLowerValue( QLocale().toString( range.lowerValue(), 'f', decimalPlaces ) );
dialog.setUpperValue( QLocale().toString( range.upperValue(), 'f', decimalPlaces ) );

if ( dialog.exec() == QDialog::Accepted )
{

0 comments on commit ba4fb65

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