Skip to content

Commit b7772d4

Browse files
committed
Fix point picking precision for point parameters in processing dialog
1 parent b2aa978 commit b7772d4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,10 @@ void QgsProcessingPointPanel::clear()
22052205

22062206
void QgsProcessingPointPanel::setValue( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs )
22072207
{
2208-
QString newText = QStringLiteral( "%1,%2" ).arg( point.x() ).arg( point.y() );
2208+
QString newText = QStringLiteral( "%1,%2" )
2209+
.arg( QString::number( point.x(), 'g', 18 ) )
2210+
.arg( QString::number( point.y(), 'g', 18 ) );
2211+
22092212
mCrs = crs;
22102213
if ( mCrs.isValid() )
22112214
{

tests/src/gui/testprocessinggui.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -2841,19 +2841,23 @@ void TestProcessingGui::testPointPanel()
28412841
QCOMPARE( panel->value().toString(), QStringLiteral( "200,250 [EPSG:3111]" ) );
28422842
QCOMPARE( spy.count(), 2 );
28432843

2844+
panel->setValue( QgsPointXY( 123456.123456789122, 654321.987654321012 ), QgsCoordinateReferenceSystem() );
2845+
QCOMPARE( panel->value().toString(), QStringLiteral( "123456.123456789122,654321.987654321012" ) );
2846+
QCOMPARE( spy.count(), 3 );
2847+
28442848
QVERIFY( !panel->mLineEdit->showClearButton() );
28452849
panel->setAllowNull( true );
28462850
QVERIFY( panel->mLineEdit->showClearButton() );
28472851
panel->clear();
28482852
QVERIFY( !panel->value().isValid() );
2849-
QCOMPARE( spy.count(), 3 );
2853+
QCOMPARE( spy.count(), 4 );
28502854

28512855
QgsMapCanvas canvas;
28522856
canvas.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:28356" ) ) );
28532857
panel->setMapCanvas( &canvas );
28542858
panel->updatePoint( QgsPointXY( 1.5, -3.5 ) );
28552859
QCOMPARE( panel->value().toString(), QStringLiteral( "1.5,-3.5 [EPSG:28356]" ) );
2856-
QCOMPARE( spy.count(), 4 );
2860+
QCOMPARE( spy.count(), 5 );
28572861

28582862
panel.reset();
28592863
}

0 commit comments

Comments
 (0)