Skip to content
Permalink
Browse files

correctly update extent/CRS when setting map canvas

  • Loading branch information
3nids committed Nov 6, 2018
1 parent 107e646 commit dd14e5817223a01507e24fd0c578b7509d5180d4
Showing with 4 additions and 2 deletions.
  1. +1 −1 src/core/locator/qgslocatormodelbridge.cpp
  2. +3 −1 src/gui/locator/qgslocatorwidget.cpp
@@ -18,7 +18,7 @@
#include "qgslocatormodelbridge.h"
#include "qgslocator.h"
#include "qgslocatormodel.h"
#include "qgsmapsettings.h"


QgsLocatorModelBridge::QgsLocatorModelBridge( QObject *parent )
: QObject( parent )
@@ -128,8 +128,10 @@ void QgsLocatorWidget::setMapCanvas( QgsMapCanvas *canvas )
mMapCanvas = canvas;
if ( mMapCanvas )
{
mModelBridge->updateCanvasExtent( mMapCanvas->mapSettings().visibleExtent() );
mModelBridge->updateCanvasCrs( mMapCanvas->mapSettings().destinationCrs() );
mCanvasConnections
<< connect( mMapCanvas, &QgsMapCanvas::extentsChanged, this, [ = ]() {mModelBridge->updateCanvasExtent( mMapCanvas->extent() );} )
<< connect( mMapCanvas, &QgsMapCanvas::extentsChanged, this, [ = ]() {mModelBridge->updateCanvasExtent( mMapCanvas->mapSettings().visibleExtent() );} )
<< connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, [ = ]() {mModelBridge->updateCanvasCrs( mMapCanvas->mapSettings().destinationCrs() );} ) ;
}
}

0 comments on commit dd14e58

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