Skip to content

Commit

Permalink
[layouts] When a map is set to a user crs and the definition of that
Browse files Browse the repository at this point in the history
crs changes, automatically update the map and don't get "stuck" with
the old definition of the user crs
  • Loading branch information
nyalldawson committed Jan 29, 2021
1 parent ddf35cf commit 8362c76
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/layout/qgslayoutitemmap.cpp
Expand Up @@ -34,6 +34,7 @@
#include "qgsexpressioncontextutils.h"
#include "qgsstyleentityvisitor.h"
#include "qgsannotationlayer.h"
#include "qgscoordinatereferencesystemregistry.h"

#include <QPainter>
#include <QStyleOptionGraphicsItem>
Expand Down Expand Up @@ -69,6 +70,17 @@ QgsLayoutItemMap::QgsLayoutItemMap( QgsLayout *layout )
refresh();
} );

connect( QgsApplication::coordinateReferenceSystemRegistry(), &QgsCoordinateReferenceSystemRegistry::userCrsChanged, this, [ = ]
{
QgsCoordinateReferenceSystem crs = mCrs;
crs.updateDefinition();
if ( mCrs != crs )
{
setCrs( crs );
invalidateCache();
}
} );

if ( layout )
connectUpdateSlot();
}
Expand Down

0 comments on commit 8362c76

Please sign in to comment.