Skip to content

Commit 12c75d3

Browse files
committedOct 29, 2018
Fix geometry precision input in vector layer properties and not-dot locales
Fix #20255 - Impossible to enter a decimal value for the geometry precision in French (comma as decimal separator)
1 parent 8fc4378 commit 12c75d3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,11 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
408408
mGeometryPrecisionLineEdit->setValidator( new QDoubleValidator( mGeometryPrecisionLineEdit ) );
409409

410410
mRemoveDuplicateNodesCheckbox->setChecked( mLayer->geometryOptions()->removeDuplicateNodes() );
411-
mGeometryPrecisionLineEdit->setText( QString::number( mLayer->geometryOptions()->geometryPrecision() ) );
411+
bool ok = true;
412+
QString precision( QLocale().toString( mLayer->geometryOptions()->geometryPrecision(), ok ) );
413+
if ( ! ok )
414+
precision = 0.0;
415+
mGeometryPrecisionLineEdit->setText( precision );
412416

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

@@ -782,7 +786,11 @@ void QgsVectorLayerProperties::apply()
782786
#endif
783787

784788
mLayer->geometryOptions()->setRemoveDuplicateNodes( mRemoveDuplicateNodesCheckbox->isChecked() );
785-
mLayer->geometryOptions()->setGeometryPrecision( mGeometryPrecisionLineEdit->text().toDouble() );
789+
bool ok = true;
790+
double precision( QLocale().toDouble( mGeometryPrecisionLineEdit->text(), &ok ) );
791+
if ( ! ok )
792+
precision = 0.0;
793+
mLayer->geometryOptions()->setGeometryPrecision( precision );
786794

787795
QStringList activeChecks;
788796
QHash<QCheckBox *, QString>::const_iterator it;

0 commit comments

Comments
 (0)
Please sign in to comment.