Skip to content

Commit

Permalink
use localized representation of scales in scale combobox, improved patch
Browse files Browse the repository at this point in the history
from Alvaro Huarte (fix #8733)
  • Loading branch information
alexbruy committed Oct 19, 2013
1 parent bdc02a2 commit 82e6451
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/gui/qgsscalecombobox.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) ) );
}
}

Expand Down

0 comments on commit 82e6451

Please sign in to comment.