From 0f66173963683e6a8e5cdecbb778333ba8910ce0 Mon Sep 17 00:00:00 2001 From: Andrea Giudiceandrea Date: Sun, 15 Dec 2024 19:45:16 +0100 Subject: [PATCH] [Georeferencer] Fix setting target CRS --- src/app/georeferencer/qgsgeorefmainwindow.cpp | 7 ++++--- src/app/georeferencer/qgsgeorefmainwindow.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/georeferencer/qgsgeorefmainwindow.cpp b/src/app/georeferencer/qgsgeorefmainwindow.cpp index 6c463f981b55..549dcb66e066 100644 --- a/src/app/georeferencer/qgsgeorefmainwindow.cpp +++ b/src/app/georeferencer/qgsgeorefmainwindow.cpp @@ -87,6 +87,8 @@ const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastSourceFolde const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastRasterFileFilter = new QgsSettingsEntryString( QStringLiteral( "last-raster-file-filter" ), sTreeGeoreferencer, QString(), QObject::tr( "Last used raster file filter for georeferencer source files" ) ); +const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastTargetCrs = new QgsSettingsEntryString( QStringLiteral( "last-target-crs" ), sTreeGeoreferencer, QString(), QObject::tr( "Last used georeferencer target CRS" ) ); + QgsGeorefDockWidget::QgsGeorefDockWidget( const QString &title, QWidget *parent, Qt::WindowFlags flags ) : QgsDockWidget( title, parent, flags ) { @@ -108,9 +110,6 @@ QgsGeoreferencerMainWindow::QgsGeoreferencerMainWindow( QWidget *parent, Qt::Win mCentralLayout->setContentsMargins( 0, 0, 0, 0 ); QgsSettings settings; - // default to last used target CRS - QString targetCRSString = settings.value( QStringLiteral( "/Plugin-GeoReferencer/targetsrs" ) ).toString(); - mTargetCrs = QgsCoordinateReferenceSystem( targetCRSString ); createActions(); createActionGroups(); @@ -1376,6 +1375,7 @@ void QgsGeoreferencerMainWindow::readSettings() mTransformMethod = settingTransformMethod->value(); mSaveGcp = settingSaveGcps->value(); mLoadInQgis = settingLoadInProject->value(); + mTargetCrs = QgsCoordinateReferenceSystem( settingLastTargetCrs->value() ); } void QgsGeoreferencerMainWindow::writeSettings() @@ -1389,6 +1389,7 @@ void QgsGeoreferencerMainWindow::writeSettings() settingUseZeroForTransparent->setValue( mUseZeroForTrans ); settingSaveGcps->setValue( mSaveGcp ); settingLoadInProject->setValue( mLoadInQgis ); + settingLastTargetCrs->setValue( mTargetCrs.authid() ); } bool QgsGeoreferencerMainWindow::loadGCPs( QString &error ) diff --git a/src/app/georeferencer/qgsgeorefmainwindow.h b/src/app/georeferencer/qgsgeorefmainwindow.h index eb609e575a2a..e179727479e1 100644 --- a/src/app/georeferencer/qgsgeorefmainwindow.h +++ b/src/app/georeferencer/qgsgeorefmainwindow.h @@ -75,6 +75,7 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg static const QgsSettingsEntryBool *settingLoadInProject; static const QgsSettingsEntryString *settingLastSourceFolder; static const QgsSettingsEntryString *settingLastRasterFileFilter; + static const QgsSettingsEntryString *settingLastTargetCrs; QgsGeoreferencerMainWindow( QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~QgsGeoreferencerMainWindow() override;