Skip to content
Permalink
Browse files

use localized representation of scales in scale combobox, improved patch

from Alvaro Huarte (fix #8733)
  • Loading branch information
alexbruy committed Oct 19, 2013
1 parent bdc02a2 commit 82e645167116c29489cd72ee53cfebc54949ee5a
Showing with 15 additions and 2 deletions.
  1. +15 −2 src/gui/qgsscalecombobox.cpp
@@ -63,6 +63,19 @@ void QgsScaleComboBox::updateScales( const QStringList &scales )
}
}

QStringList parts;
double denominator;
bool ok;
for ( int i = 0; i < myScalesList.size(); ++i )
{
parts = myScalesList[ i ] .split( ':' );
denominator = QLocale::system().toDouble( parts[1], &ok );
if ( ok )
{
myScalesList[ i ] = toString( 1.0 / denominator );
}
}

blockSignals( true );
clear();
addItems( myScalesList );
@@ -180,11 +193,11 @@ QString QgsScaleComboBox::toString( double scale )
{
if ( scale > 1 )
{
return QString( "%1:1" ).arg( qRound( scale ) );
return QString( "%1:1" ).arg( QLocale::system().toString( qRound( scale ) ) );
}
else
{
return QString( "1:%1" ).arg( qRound( 1.0 / scale ) );
return QString( "1:%1" ).arg( QLocale::system().toString( qRound( 1.0 / scale ) ) );
}
}

0 comments on commit 82e6451

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