mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
use localized representation of scales in scale combobox, improved patch
from Alvaro Huarte (fix #8733)
This commit is contained in:
parent
bdc02a2369
commit
82e6451671
@ -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 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user