Skip to content

Commit

Permalink
[locator] Flash canvas center point when triggering goto result
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Aug 4, 2020
1 parent 12a1a0d commit 655c2ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/locator/qgsinbuiltlocatorfilters.cpp
Expand Up @@ -926,9 +926,11 @@ void QgsGotoLocatorFilter::fetchResults( const QString &string, const QgsLocator

void QgsGotoLocatorFilter::triggerResult( const QgsLocatorResult &result )
{
QVariantMap data = result.userData.toMap();
QgsMapCanvas *mapCanvas = QgisApp::instance()->mapCanvas();
mapCanvas->setCenter( data[QStringLiteral( "point" )].value<QgsPointXY>() );

QVariantMap data = result.userData.toMap();
QgsPointXY point = data[QStringLiteral( "point" )].value<QgsPointXY>();
mapCanvas->setCenter( point );
if ( data.contains( QStringLiteral( "scale" ) ) )
{
mapCanvas->zoomScale( data[QStringLiteral( "scale" )].toDouble() );
Expand All @@ -937,4 +939,6 @@ void QgsGotoLocatorFilter::triggerResult( const QgsLocatorResult &result )
{
mapCanvas->refresh();
}

mapCanvas->flashGeometries( QList< QgsGeometry >() << QgsGeometry::fromPointXY( point ) );
}

0 comments on commit 655c2ca

Please sign in to comment.