Skip to content
Permalink
Browse files

Fix geometry precision input in vector layer properties and not-dot l…

…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 29, 2018
1 parent 06b4483 commit 344a5a69e5cf4ed9163a87ac137b7101e1276589
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/app/qgsvectorlayerproperties.cpp
@@ -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() ) ) );

@@ -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;

0 comments on commit 344a5a6

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