Skip to content

Commit 2ca28f3

Browse files
authored
Merge pull request #8379 from elpaso/backport-3_4
Backport: Fix geometry precision input in vector layer properties and not-dot
2 parents 06b4483 + 24eaea5 commit 2ca28f3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/app/qgsvectorlayerproperties.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,12 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
408408
mGeometryPrecisionLineEdit->setValidator( new QDoubleValidator( mGeometryPrecisionLineEdit ) );
409409

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

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

@@ -782,7 +787,11 @@ void QgsVectorLayerProperties::apply()
782787
#endif
783788

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

787796
QStringList activeChecks;
788797
QHash<QCheckBox *, QString>::const_iterator it;

0 commit comments

Comments
 (0)