Skip to content

Commit

Permalink
Fix locale problem in graduated symmetric classification option
Browse files Browse the repository at this point in the history
  • Loading branch information
SrNetoChan authored and nyalldawson committed Feb 3, 2021
1 parent 45ad03c commit ab39dad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
Expand Up @@ -52,6 +52,7 @@
#include "qgsprocessingcontext.h"
#include "qgsprocessingwidgetwrapper.h"
#include "qgstemporalcontroller.h"
#include "qgsdoublevalidator.h"



Expand Down Expand Up @@ -698,7 +699,7 @@ void QgsGraduatedSymbolRendererWidget::updateUiFromRenderer( bool updateCount )
mGroupBoxSymmetric->setChecked( method->symmetricModeEnabled() );
cbxAstride->setChecked( method->symmetryAstride() );
if ( method->symmetricModeEnabled() )
cboSymmetryPoint->setItemText( cboSymmetryPoint->currentIndex(), QString::number( method->symmetryPoint(), 'f', method->labelPrecision() + 2 ) );
cboSymmetryPoint->setItemText( cboSymmetryPoint->currentIndex(), QLocale().toString( method->symmetryPoint(), 'f', method->labelPrecision() + 2 ) );

txtLegendFormat->setText( method->labelFormat() );
spinPrecision->setValue( method->labelPrecision() );
Expand Down Expand Up @@ -1002,14 +1003,14 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
{
// knowing that spinSymmetryPointForOtherMethods->value() is automatically put at minimum when out of min-max
// using "(maximum-minimum)/100)" to avoid direct comparison of doubles
double currentValue = cboSymmetryPoint->currentText().toDouble();
double currentValue = QgsDoubleValidator::toDouble( cboSymmetryPoint->currentText() );
if ( currentValue < ( minimum + ( maximum - minimum ) / 100. ) || currentValue > ( maximum - ( maximum - minimum ) / 100. ) )
cboSymmetryPoint->setItemText( cboSymmetryPoint->currentIndex(), QString::number( minimum + ( maximum - minimum ) / 2., 'f', method->labelPrecision() + 2 ) );
cboSymmetryPoint->setItemText( cboSymmetryPoint->currentIndex(), QLocale().toString( minimum + ( maximum - minimum ) / 2., 'f', method->labelPrecision() + 2 ) );
}

if ( mGroupBoxSymmetric->isChecked() )
{
double symmetryPoint = cboSymmetryPoint->currentText().toDouble();
double symmetryPoint = QgsDoubleValidator::toDouble( cboSymmetryPoint->currentText() );
bool astride = cbxAstride->isChecked();
method->setSymmetricMode( true, symmetryPoint, astride );
}
Expand Down

0 comments on commit ab39dad

Please sign in to comment.