Skip to content
Permalink
Browse files

Fix point picking precision for point parameters in processing dialog

  • Loading branch information
troopa81 committed Apr 26, 2019
1 parent b2aa978 commit b7772d407d9c00c81b1e10360e9735bb367da0dc
Showing with 10 additions and 3 deletions.
  1. +4 −1 src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
  2. +6 −2 tests/src/gui/testprocessinggui.cpp
@@ -2205,7 +2205,10 @@ void QgsProcessingPointPanel::clear()

void QgsProcessingPointPanel::setValue( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs )
{
QString newText = QStringLiteral( "%1,%2" ).arg( point.x() ).arg( point.y() );
QString newText = QStringLiteral( "%1,%2" )
.arg( QString::number( point.x(), 'g', 18 ) )
.arg( QString::number( point.y(), 'g', 18 ) );

mCrs = crs;
if ( mCrs.isValid() )
{
@@ -2841,19 +2841,23 @@ void TestProcessingGui::testPointPanel()
QCOMPARE( panel->value().toString(), QStringLiteral( "200,250 [EPSG:3111]" ) );
QCOMPARE( spy.count(), 2 );

panel->setValue( QgsPointXY( 123456.123456789122, 654321.987654321012 ), QgsCoordinateReferenceSystem() );
QCOMPARE( panel->value().toString(), QStringLiteral( "123456.123456789122,654321.987654321012" ) );
QCOMPARE( spy.count(), 3 );

QVERIFY( !panel->mLineEdit->showClearButton() );
panel->setAllowNull( true );
QVERIFY( panel->mLineEdit->showClearButton() );
panel->clear();
QVERIFY( !panel->value().isValid() );
QCOMPARE( spy.count(), 3 );
QCOMPARE( spy.count(), 4 );

QgsMapCanvas canvas;
canvas.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:28356" ) ) );
panel->setMapCanvas( &canvas );
panel->updatePoint( QgsPointXY( 1.5, -3.5 ) );
QCOMPARE( panel->value().toString(), QStringLiteral( "1.5,-3.5 [EPSG:28356]" ) );
QCOMPARE( spy.count(), 4 );
QCOMPARE( spy.count(), 5 );

panel.reset();
}

0 comments on commit b7772d4

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