Skip to content

Commit

Permalink
Automatically update map canvas if set to a user crs and the user cha…
Browse files Browse the repository at this point in the history
…nges

that crs definition, instead of getting stuck with an old definition of
the crs
  • Loading branch information
nyalldawson committed Jan 29, 2021
1 parent 8362c76 commit ea57cfe
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -85,6 +85,7 @@ email : sherman at mrcc.com
#include "qgsprojectionselectiondialog.h"
#include "qgsannotationlayer.h"
#include "qgsmaplayerelevationproperties.h"
#include "qgscoordinatereferencesystemregistry.h"

/**
* \ingroup gui
Expand Down Expand Up @@ -169,6 +170,17 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
emit transformContextChanged();
refresh();
} );

connect( QgsApplication::coordinateReferenceSystemRegistry(), &QgsCoordinateReferenceSystemRegistry::userCrsChanged, this, [ = ]
{
QgsCoordinateReferenceSystem crs = mSettings.destinationCrs();
crs.updateDefinition();
if ( mSettings.destinationCrs() != crs )
{
// user crs has changed definition, refresh the map
setDestinationCrs( crs );
}
} );
}

// refresh canvas when a remote svg/image has finished downloading
Expand Down

0 comments on commit ea57cfe

Please sign in to comment.