Skip to content

Commit

Permalink
Fix geometry precision input in vector layer properties and not-dot l…
Browse files Browse the repository at this point in the history
…ocales

Fix #20255 - Impossible to enter a decimal value for the geometry precision in French (comma as decimal separator)

Backported from master
  • Loading branch information
elpaso committed Oct 30, 2018
1 parent 06b4483 commit 344a5a6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -408,7 +408,11 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
mGeometryPrecisionLineEdit->setValidator( new QDoubleValidator( mGeometryPrecisionLineEdit ) );

mRemoveDuplicateNodesCheckbox->setChecked( mLayer->geometryOptions()->removeDuplicateNodes() );
mGeometryPrecisionLineEdit->setText( QString::number( mLayer->geometryOptions()->geometryPrecision() ) );
bool ok = true;
QString precision( QLocale().toString( mLayer->geometryOptions()->geometryPrecision(), ok ) );
if ( ! ok )
precision = 0.0;
mGeometryPrecisionLineEdit->setText( precision );

mPrecisionUnitsLabel->setText( QStringLiteral( "[%1]" ).arg( QgsUnitTypes::toAbbreviatedString( mLayer->crs().mapUnits() ) ) );

Expand Down Expand Up @@ -782,7 +786,11 @@ void QgsVectorLayerProperties::apply()
#endif

mLayer->geometryOptions()->setRemoveDuplicateNodes( mRemoveDuplicateNodesCheckbox->isChecked() );
mLayer->geometryOptions()->setGeometryPrecision( mGeometryPrecisionLineEdit->text().toDouble() );
bool ok = true;
double precision( QLocale().toDouble( mGeometryPrecisionLineEdit->text(), &ok ) );
if ( ! ok )
precision = 0.0;
mLayer->geometryOptions()->setGeometryPrecision( precision );

QStringList activeChecks;
QHash<QCheckBox *, QString>::const_iterator it;
Expand Down

0 comments on commit 344a5a6

Please sign in to comment.