Skip to content

Commit

Permalink
Update stored crs definitions in QgsProjectionSelectionWidget when us…
Browse files Browse the repository at this point in the history
…er crses change

Avoids very confusing behavior when selecting a user crs from the widget
and getting instead an old definition of the user crs
  • Loading branch information
nyalldawson committed Jan 29, 2021
1 parent a0d873b commit 10310db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/qgsprojectionselectionwidget.cpp
Expand Up @@ -21,6 +21,7 @@
#include "qgsproject.h"
#include "qgssettings.h"
#include "qgshighlightablecombobox.h"
#include "qgscoordinatereferencesystemregistry.h"

QgsProjectionSelectionWidget::QgsProjectionSelectionWidget( QWidget *parent )
: QWidget( parent )
Expand Down Expand Up @@ -61,6 +62,14 @@ QgsProjectionSelectionWidget::QgsProjectionSelectionWidget( QWidget *parent )

connect( mButton, &QToolButton::clicked, this, &QgsProjectionSelectionWidget::selectCrs );
connect( mCrsComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsProjectionSelectionWidget::comboIndexChanged );

connect( QgsApplication::coordinateReferenceSystemRegistry(), &QgsCoordinateReferenceSystemRegistry::userCrsChanged, this, [ = ]
{
mCrs.updateDefinition();
mLayerCrs.updateDefinition();
mProjectCrs.updateDefinition();
mDefaultCrs.updateDefinition();
} );
}

QgsCoordinateReferenceSystem QgsProjectionSelectionWidget::crs() const
Expand Down

0 comments on commit 10310db

Please sign in to comment.