From 059277ceca7f4ea59cbdb61016cd2d60ef5472af Mon Sep 17 00:00:00 2001 From: Harrissou Sant-anna Date: Fri, 21 Jun 2019 08:08:37 +0200 Subject: [PATCH] Remove some dialogs geometry size settings replaced with automatic restoring --- python/gui/auto_generated/qgsmessageviewer.sip.in | 1 - .../auto_generated/qgsnewmemorylayerdialog.sip.in | 1 - .../layout/qgslayoutattributeselectiondialog.cpp | 12 +++--------- .../layout/qgslayoutattributeselectiondialog.h | 2 -- src/app/layout/qgslayoutlegendlayersdialog.cpp | 10 ++-------- src/app/layout/qgslayoutlegendlayersdialog.h | 1 - .../qgslayouttablebackgroundcolorsdialog.cpp | 12 +++--------- .../layout/qgslayouttablebackgroundcolorsdialog.h | 2 -- src/app/qgsattributetypedialog.cpp | 7 +------ src/app/qgsdelattrdialog.cpp | 12 +++--------- src/app/qgsdelattrdialog.h | 2 +- src/app/qgsmergeattributesdialog.cpp | 13 ++++--------- src/app/qgsprojectlayergroupdialog.cpp | 10 ++-------- src/app/qgsselectbyformdialog.cpp | 10 ++-------- src/app/qgsselectbyformdialog.h | 2 -- src/app/qgsvectorlayersavestyledialog.cpp | 10 +++------- src/app/qgsvectorlayersavestyledialog.h | 1 - src/gui/ogr/qgsnewogrconnection.cpp | 10 +++------- src/gui/ogr/qgsnewogrconnection.h | 1 - src/gui/qgscolordialog.cpp | 15 +++------------ src/gui/qgscolordialog.h | 5 ----- src/gui/qgsmessageviewer.cpp | 12 +++--------- src/gui/qgsmessageviewer.h | 1 - src/gui/qgsnewmemorylayerdialog.cpp | 11 ++--------- src/gui/qgsnewmemorylayerdialog.h | 1 - src/gui/qgssublayersdialog.cpp | 6 ++---- src/gui/qgssubstitutionlistwidget.cpp | 4 ++++ src/gui/symbology/qgsrendererpropertiesdialog.cpp | 1 + .../geometry_checker/qgsgeometrycheckerdialog.cpp | 11 ++--------- .../geometry_checker/qgsgeometrycheckerdialog.h | 2 +- .../georeferencer/qgsgeorefconfigdialog.cpp | 12 +++--------- src/plugins/georeferencer/qgsgeorefconfigdialog.h | 1 - src/plugins/georeferencer/qgsmapcoordsdialog.cpp | 10 +++++----- .../offline_editing_plugin_gui.cpp | 5 +++-- src/providers/wms/qgstilescalewidget.cpp | 2 ++ src/providers/wms/qgswmssourceselect.cpp | 12 +++--------- src/providers/wms/qgswmssourceselect.h | 2 -- src/providers/wms/qgswmtsdimensions.cpp | 13 ++----------- src/providers/wms/qgswmtsdimensions.h | 2 -- src/providers/wms/qgsxyzconnectiondialog.cpp | 2 ++ 40 files changed, 65 insertions(+), 184 deletions(-) diff --git a/python/gui/auto_generated/qgsmessageviewer.sip.in b/python/gui/auto_generated/qgsmessageviewer.sip.in index 3b6acbff999..feb7471cde6 100644 --- a/python/gui/auto_generated/qgsmessageviewer.sip.in +++ b/python/gui/auto_generated/qgsmessageviewer.sip.in @@ -21,7 +21,6 @@ A generic message view for displaying QGIS messages. %End public: QgsMessageViewer( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, bool deleteOnClose = true ); - ~QgsMessageViewer(); virtual void setMessage( const QString &message, MessageType msgType ); diff --git a/python/gui/auto_generated/qgsnewmemorylayerdialog.sip.in b/python/gui/auto_generated/qgsnewmemorylayerdialog.sip.in index 8471c10c856..b1d0d7c4814 100644 --- a/python/gui/auto_generated/qgsnewmemorylayerdialog.sip.in +++ b/python/gui/auto_generated/qgsnewmemorylayerdialog.sip.in @@ -31,7 +31,6 @@ Runs the dialog and creates a new memory layer %Docstring New dialog constructor. %End - ~QgsNewMemoryLayerDialog(); QgsWkbTypes::Type selectedType() const; %Docstring diff --git a/src/app/layout/qgslayoutattributeselectiondialog.cpp b/src/app/layout/qgslayoutattributeselectiondialog.cpp index c4bcdfd5dc7..598d8db8f98 100644 --- a/src/app/layout/qgslayoutattributeselectiondialog.cpp +++ b/src/app/layout/qgslayoutattributeselectiondialog.cpp @@ -21,6 +21,7 @@ #include "qgsfieldexpressionwidget.h" #include "qgsdoublespinbox.h" #include "qgssettings.h" +#include "qgsgui.h" #include "qgslayouttablecolumn.h" #include @@ -885,6 +886,8 @@ QgsLayoutAttributeSelectionDialog::QgsLayoutAttributeSelectionDialog( QgsLayoutI { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( mRemoveColumnPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mRemoveColumnPushButton_clicked ); connect( mAddColumnPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mAddColumnPushButton_clicked ); connect( mColumnUpPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mColumnUpPushButton_clicked ); @@ -896,9 +899,6 @@ QgsLayoutAttributeSelectionDialog::QgsLayoutAttributeSelectionDialog( QgsLayoutI connect( mSortColumnUpPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mSortColumnUpPushButton_clicked ); connect( mSortColumnDownPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mSortColumnDownPushButton_clicked ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/AttributeSelectionDialog/geometry" ) ).toByteArray() ); - if ( mTable ) { //set up models, views and delegates @@ -933,12 +933,6 @@ QgsLayoutAttributeSelectionDialog::QgsLayoutAttributeSelectionDialog( QgsLayoutI mOrderComboBox->insertItem( 1, tr( "Descending" ) ); } -QgsLayoutAttributeSelectionDialog::~QgsLayoutAttributeSelectionDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/AttributeSelectionDialog/geometry" ), saveGeometry() ); -} - void QgsLayoutAttributeSelectionDialog::mRemoveColumnPushButton_clicked() { //remove selected rows from model diff --git a/src/app/layout/qgslayoutattributeselectiondialog.h b/src/app/layout/qgslayoutattributeselectiondialog.h index b4d02c5c168..875c164db21 100644 --- a/src/app/layout/qgslayoutattributeselectiondialog.h +++ b/src/app/layout/qgslayoutattributeselectiondialog.h @@ -286,8 +286,6 @@ class QgsLayoutAttributeSelectionDialog: public QDialog, private Ui::QgsLayoutAt public: QgsLayoutAttributeSelectionDialog( QgsLayoutItemAttributeTable *table, QgsVectorLayer *vLayer, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr ); - ~QgsLayoutAttributeSelectionDialog() override; - private slots: void mRemoveColumnPushButton_clicked(); void mAddColumnPushButton_clicked(); diff --git a/src/app/layout/qgslayoutlegendlayersdialog.cpp b/src/app/layout/qgslayoutlegendlayersdialog.cpp index 16ac0157826..d247b2a6851 100644 --- a/src/app/layout/qgslayoutlegendlayersdialog.cpp +++ b/src/app/layout/qgslayoutlegendlayersdialog.cpp @@ -19,13 +19,13 @@ #include "qgsmaplayermodel.h" #include "qgsmaplayerproxymodel.h" #include "qgssettings.h" +#include "qgsgui.h" QgsLayoutLegendLayersDialog::QgsLayoutLegendLayersDialog( QWidget *parent ) : QDialog( parent ) { setupUi( this ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/LayoutLegendLayers/geometry" ) ).toByteArray() ); + QgsGui::enableAutoGeometryRestore( this ); mFilterLineEdit->setShowClearButton( true ); mFilterLineEdit->setShowSearchIcon( true ); @@ -41,12 +41,6 @@ QgsLayoutLegendLayersDialog::QgsLayoutLegendLayersDialog( QWidget *parent ) connect( mCheckBoxVisibleLayers, &QCheckBox::toggled, this, &QgsLayoutLegendLayersDialog::filterVisible ); } -QgsLayoutLegendLayersDialog::~QgsLayoutLegendLayersDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/LayoutLegendLayers/geometry" ), saveGeometry() ); -} - void QgsLayoutLegendLayersDialog::setVisibleLayers( const QList &layers ) { mVisibleLayers = layers; diff --git a/src/app/layout/qgslayoutlegendlayersdialog.h b/src/app/layout/qgslayoutlegendlayersdialog.h index 517a697d78e..ba73bde7fc9 100644 --- a/src/app/layout/qgslayoutlegendlayersdialog.h +++ b/src/app/layout/qgslayoutlegendlayersdialog.h @@ -30,7 +30,6 @@ class QgsLayoutLegendLayersDialog: public QDialog, private Ui::QgsLayoutLegendLa public: QgsLayoutLegendLayersDialog( QWidget *parent = nullptr ); - ~QgsLayoutLegendLayersDialog() override; /** * Sets a list of visible \a layers, to use for filtering within the dialog. diff --git a/src/app/layout/qgslayouttablebackgroundcolorsdialog.cpp b/src/app/layout/qgslayouttablebackgroundcolorsdialog.cpp index 1fb2e532c31..e59466a09be 100644 --- a/src/app/layout/qgslayouttablebackgroundcolorsdialog.cpp +++ b/src/app/layout/qgslayouttablebackgroundcolorsdialog.cpp @@ -19,6 +19,7 @@ #include "qgslayouttable.h" #include "qgslayout.h" #include "qgssettings.h" +#include "qgsgui.h" #include #include @@ -28,6 +29,8 @@ QgsLayoutTableBackgroundColorsDialog::QgsLayoutTableBackgroundColorsDialog( QgsL , mTable( table ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsLayoutTableBackgroundColorsDialog::buttonBox_accepted ); connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsLayoutTableBackgroundColorsDialog::buttonBox_rejected ); @@ -53,18 +56,9 @@ QgsLayoutTableBackgroundColorsDialog::QgsLayoutTableBackgroundColorsDialog( QgsL connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsLayoutTableBackgroundColorsDialog::apply ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/ComposerTableBackgroundColorsDialog/geometry" ) ).toByteArray() ); - setGuiElementValues(); } -QgsLayoutTableBackgroundColorsDialog::~QgsLayoutTableBackgroundColorsDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/ComposerTableBackgroundColorsDialog/geometry" ), saveGeometry() ); -} - void QgsLayoutTableBackgroundColorsDialog::apply() { if ( !mTable ) diff --git a/src/app/layout/qgslayouttablebackgroundcolorsdialog.h b/src/app/layout/qgslayouttablebackgroundcolorsdialog.h index 8719f3710f7..d77ad6238c0 100644 --- a/src/app/layout/qgslayouttablebackgroundcolorsdialog.h +++ b/src/app/layout/qgslayouttablebackgroundcolorsdialog.h @@ -42,8 +42,6 @@ class QgsLayoutTableBackgroundColorsDialog: public QDialog, private Ui::QgsLayou */ QgsLayoutTableBackgroundColorsDialog( QgsLayoutTable *table, QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr ); - ~QgsLayoutTableBackgroundColorsDialog() override; - private slots: void apply(); diff --git a/src/app/qgsattributetypedialog.cpp b/src/app/qgsattributetypedialog.cpp index 04e1ba58ca5..0720c43bc3c 100644 --- a/src/app/qgsattributetypedialog.cpp +++ b/src/app/qgsattributetypedialog.cpp @@ -47,6 +47,7 @@ QgsAttributeTypeDialog::QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx , mFieldIdx( fieldIdx ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); if ( fieldIdx < 0 ) return; @@ -88,18 +89,12 @@ QgsAttributeTypeDialog::QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx } ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/QgsAttributeTypeDialog/geometry" ) ).toByteArray() ); - constraintExpressionWidget->setAllowEmptyFieldName( true ); constraintExpressionWidget->setLayer( vl ); } QgsAttributeTypeDialog::~QgsAttributeTypeDialog() { - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/QgsAttributeTypeDialog/geometry" ), saveGeometry() ); - qDeleteAll( mEditorConfigWidgets ); } diff --git a/src/app/qgsdelattrdialog.cpp b/src/app/qgsdelattrdialog.cpp index ed17df25a34..4fe97ed00ef 100644 --- a/src/app/qgsdelattrdialog.cpp +++ b/src/app/qgsdelattrdialog.cpp @@ -21,10 +21,13 @@ #include "qgsvectordataprovider.h" #include "qgsvectorlayer.h" #include "qgssettings.h" +#include "qgsgui.h" QgsDelAttrDialog::QgsDelAttrDialog( const QgsVectorLayer *vl ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + if ( vl ) { bool canDeleteAttributes = vl->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes; @@ -57,15 +60,6 @@ QgsDelAttrDialog::QgsDelAttrDialog( const QgsVectorLayer *vl ) mEditModeInfo->setVisible( !vl->isEditable() ); mCanDeleteAttributesInfo->setVisible( !canDeleteAttributes ); } - - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/QgsDelAttrDialog/geometry" ) ).toByteArray() ); -} - -QgsDelAttrDialog::~QgsDelAttrDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/QgsDelAttrDialog/geometry" ), saveGeometry() ); } QList QgsDelAttrDialog::selectedAttributes() diff --git a/src/app/qgsdelattrdialog.h b/src/app/qgsdelattrdialog.h index 2e73b303b9f..c9d1819982e 100644 --- a/src/app/qgsdelattrdialog.h +++ b/src/app/qgsdelattrdialog.h @@ -30,7 +30,7 @@ class APP_EXPORT QgsDelAttrDialog: public QDialog, private Ui::QgsDelAttrDialogB Q_OBJECT public: QgsDelAttrDialog( const QgsVectorLayer *vl ); - ~QgsDelAttrDialog() override; + //! Returns the selected attribute indices QList selectedAttributes(); }; diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index e359131f9ab..851f84a154d 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -60,6 +60,8 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( mFromSelectedPushButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mFromSelectedPushButton_clicked ); connect( mRemoveFeatureFromSelectionButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mRemoveFeatureFromSelectionButton_clicked ); createTableWidgetContents(); @@ -75,9 +77,6 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur mFromSelectedPushButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionFromSelectedFeature.svg" ) ) ); mRemoveFeatureFromSelectionButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionRemoveSelectedFeature.svg" ) ) ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/MergeAttributes/geometry" ) ).toByteArray() ); - connect( mSkipAllButton, &QAbstractButton::clicked, this, &QgsMergeAttributesDialog::setAllToSkip ); connect( mTableWidget, &QTableWidget::cellChanged, this, &QgsMergeAttributesDialog::tableWidgetCellChanged ); } @@ -85,18 +84,14 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur QgsMergeAttributesDialog::QgsMergeAttributesDialog() { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( mFromSelectedPushButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mFromSelectedPushButton_clicked ); connect( mRemoveFeatureFromSelectionButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mRemoveFeatureFromSelectionButton_clicked ); - - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/MergeAttributes/geometry" ) ).toByteArray() ); } QgsMergeAttributesDialog::~QgsMergeAttributesDialog() { - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/MergeAttributes/geometry" ), saveGeometry() ); - delete mSelectionRubberBand; } diff --git a/src/app/qgsprojectlayergroupdialog.cpp b/src/app/qgsprojectlayergroupdialog.cpp index 3496405154e..fc7c074e8a6 100644 --- a/src/app/qgsprojectlayergroupdialog.cpp +++ b/src/app/qgsprojectlayergroupdialog.cpp @@ -21,6 +21,7 @@ #include "qgslayertreeutils.h" #include "qgssettings.h" #include "qgsziputils.h" +#include "qgsgui.h" #include #include @@ -48,6 +49,7 @@ QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog( QWidget *parent, const Q , mRootGroup( new QgsLayerTree ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); QgsEmbeddedLayerTreeModel *model = new QgsEmbeddedLayerTreeModel( mRootGroup, this ); mTreeView->setModel( model ); @@ -74,21 +76,13 @@ QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog( QWidget *parent, const Q } connect( mProjectFileWidget, &QgsFileWidget::fileChanged, this, &QgsProjectLayerGroupDialog::changeProjectFile ); - connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsProjectLayerGroupDialog::mButtonBox_accepted ); - - restoreGeometry( settings.value( QStringLiteral( "Windows/EmbedLayer/geometry" ) ).toByteArray() ); - - connect( mButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject ); connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsProjectLayerGroupDialog::showHelp ); } QgsProjectLayerGroupDialog::~QgsProjectLayerGroupDialog() { - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/EmbedLayer/geometry" ), saveGeometry() ); - delete mRootGroup; } diff --git a/src/app/qgsselectbyformdialog.cpp b/src/app/qgsselectbyformdialog.cpp index df8dda9fa34..348e13208d8 100644 --- a/src/app/qgsselectbyformdialog.cpp +++ b/src/app/qgsselectbyformdialog.cpp @@ -21,6 +21,7 @@ #include "qgssettings.h" #include "qgsmessagebar.h" #include "qgsexpressioncontextutils.h" +#include "qgsgui.h" QgsSelectByFormDialog::QgsSelectByFormDialog( QgsVectorLayer *layer, const QgsAttributeEditorContext &context, QWidget *parent, Qt::WindowFlags fl ) @@ -44,18 +45,11 @@ QgsSelectByFormDialog::QgsSelectByFormDialog( QgsVectorLayer *layer, const QgsAt connect( mForm, &QgsAttributeForm::closed, this, &QWidget::close ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/SelectByForm/geometry" ) ).toByteArray() ); + QgsGui::enableAutoGeometryRestore( this ); setWindowTitle( tr( "Select Features by Value" ) ); } -QgsSelectByFormDialog::~QgsSelectByFormDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/SelectByForm/geometry" ), saveGeometry() ); -} - void QgsSelectByFormDialog::setMessageBar( QgsMessageBar *messageBar ) { mMessageBar = messageBar; diff --git a/src/app/qgsselectbyformdialog.h b/src/app/qgsselectbyformdialog.h index ced75fc034c..1c98ddea614 100644 --- a/src/app/qgsselectbyformdialog.h +++ b/src/app/qgsselectbyformdialog.h @@ -49,8 +49,6 @@ class APP_EXPORT QgsSelectByFormDialog : public QDialog const QgsAttributeEditorContext &context = QgsAttributeEditorContext(), QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr ); - ~QgsSelectByFormDialog() override; - /** * Sets the message bar to display feedback from the form in. This is used in the search/filter * mode to display the count of selected features. diff --git a/src/app/qgsvectorlayersavestyledialog.cpp b/src/app/qgsvectorlayersavestyledialog.cpp index 7110929ecb1..f0446b89606 100644 --- a/src/app/qgsvectorlayersavestyledialog.cpp +++ b/src/app/qgsvectorlayersavestyledialog.cpp @@ -20,6 +20,7 @@ #include "qgsvectorlayer.h" #include "qgssettings.h" #include "qgshelp.h" +#include "qgsgui.h" #include "qgsmaplayerstylecategoriesmodel.h" QgsVectorLayerSaveStyleDialog::QgsVectorLayerSaveStyleDialog( QgsVectorLayer *layer, QWidget *parent ) @@ -27,6 +28,8 @@ QgsVectorLayerSaveStyleDialog::QgsVectorLayerSaveStyleDialog( QgsVectorLayer *la , mLayer( layer ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + QgsSettings settings; QString providerName = mLayer->providerType(); @@ -81,7 +84,6 @@ QgsVectorLayerSaveStyleDialog::QgsVectorLayerSaveStyleDialog( QgsVectorLayer *la mModel->setCategories( lastStyleCategories ); mStyleCategoriesListView->setModel( mModel ); - restoreGeometry( settings.value( QStringLiteral( "Windows/vectorLayerSaveStyle/geometry" ) ).toByteArray() ); mStyleCategoriesListView->adjustSize(); } @@ -98,12 +100,6 @@ void QgsVectorLayerSaveStyleDialog::updateSaveButtonState() ( type != QgsVectorLayerProperties::DB && !mFileWidget->filePath().isEmpty() ) ); } -QgsVectorLayerSaveStyleDialog::~QgsVectorLayerSaveStyleDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/vectorLayerSaveStyle/geometry" ), saveGeometry() ); -} - QgsVectorLayerSaveStyleDialog::SaveToDbSettings QgsVectorLayerSaveStyleDialog::saveToDbSettings() const { SaveToDbSettings settings; diff --git a/src/app/qgsvectorlayersavestyledialog.h b/src/app/qgsvectorlayersavestyledialog.h index 13d21c9c183..6369ed6886e 100644 --- a/src/app/qgsvectorlayersavestyledialog.h +++ b/src/app/qgsvectorlayersavestyledialog.h @@ -40,7 +40,6 @@ class QgsVectorLayerSaveStyleDialog : public QDialog, private Ui::QgsVectorLayer }; explicit QgsVectorLayerSaveStyleDialog( QgsVectorLayer *layer, QWidget *parent = nullptr ); - ~QgsVectorLayerSaveStyleDialog() override; SaveToDbSettings saveToDbSettings() const; QString outputFilePath() const; diff --git a/src/gui/ogr/qgsnewogrconnection.cpp b/src/gui/ogr/qgsnewogrconnection.cpp index 9a4aa2deafd..0b118a9dedb 100644 --- a/src/gui/ogr/qgsnewogrconnection.cpp +++ b/src/gui/ogr/qgsnewogrconnection.cpp @@ -23,6 +23,7 @@ #include "qgsogrhelperfunctions.h" #include "qgsapplication.h" #include "qgssettings.h" +#include "qgsgui.h" #include #include @@ -33,13 +34,14 @@ QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString &connTy , mOriginalConnName( connName ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( btnConnect, &QPushButton::clicked, this, &QgsNewOgrConnection::btnConnect_clicked ); Q_NOWARN_DEPRECATED_PUSH connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsNewOgrConnection::showHelp ); Q_NOWARN_DEPRECATED_POP QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/OGRDatabaseConnection/geometry" ) ).toByteArray() ); //add database drivers QStringList dbDrivers = QgsProviderRegistry::instance()->databaseDrivers().split( ';' ); @@ -80,12 +82,6 @@ QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString &connTy mAuthSettingsDatabase->showStoreCheckboxes( true ); } -QgsNewOgrConnection::~QgsNewOgrConnection() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/OGRDatabaseConnection/geometry" ), saveGeometry() ); -} - void QgsNewOgrConnection::testConnection() { QString uri; diff --git a/src/gui/ogr/qgsnewogrconnection.h b/src/gui/ogr/qgsnewogrconnection.h index 9273e40adea..7d225a395e0 100644 --- a/src/gui/ogr/qgsnewogrconnection.h +++ b/src/gui/ogr/qgsnewogrconnection.h @@ -41,7 +41,6 @@ class GUI_EXPORT QgsNewOgrConnection : public QDialog, private Ui::QgsNewOgrConn //! Constructor QgsNewOgrConnection( QWidget *parent = nullptr, const QString &connType = QString(), const QString &connName = QString(), Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags ); - ~QgsNewOgrConnection() override; //! Tests the connection using the parameters supplied void testConnection(); diff --git a/src/gui/qgscolordialog.cpp b/src/gui/qgscolordialog.cpp index 367f3024d6f..7d73e2f6430 100644 --- a/src/gui/qgscolordialog.cpp +++ b/src/gui/qgscolordialog.cpp @@ -20,6 +20,7 @@ #include "qgssymbollayerutils.h" #include "qgsapplication.h" #include "qgssettings.h" +#include "qgsgui.h" #include #include @@ -35,13 +36,12 @@ QgsColorDialog::QgsColorDialog( QWidget *parent, Qt::WindowFlags fl, const QColo , mPreviousColor( color ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsColorDialog::mButtonBox_accepted ); connect( mButtonBox, &QDialogButtonBox::rejected, this, &QgsColorDialog::mButtonBox_rejected ); connect( mButtonBox, &QDialogButtonBox::clicked, this, &QgsColorDialog::mButtonBox_clicked ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/ColorDialog/geometry" ) ).toByteArray() ); - if ( mPreviousColor.isValid() ) { QPushButton *resetButton = new QPushButton( tr( "Reset" ) ); @@ -110,13 +110,11 @@ QColor QgsColorDialog::getColor( const QColor &initialColor, QWidget *parent, co void QgsColorDialog::mButtonBox_accepted() { - saveSettings(); accept(); } void QgsColorDialog::mButtonBox_rejected() { - saveSettings(); reject(); } @@ -133,12 +131,6 @@ void QgsColorDialog::discardColor() mColorWidget->setDiscarded( true ); } -void QgsColorDialog::saveSettings() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/ColorDialog/geometry" ), saveGeometry() ); -} - void QgsColorDialog::setColor( const QColor &color ) { if ( !color.isValid() ) @@ -159,7 +151,6 @@ void QgsColorDialog::setColor( const QColor &color ) void QgsColorDialog::closeEvent( QCloseEvent *e ) { - saveSettings(); QDialog::closeEvent( e ); } diff --git a/src/gui/qgscolordialog.h b/src/gui/qgscolordialog.h index 87dc7e2c4f2..0d619605572 100644 --- a/src/gui/qgscolordialog.h +++ b/src/gui/qgscolordialog.h @@ -114,11 +114,6 @@ class GUI_EXPORT QgsColorDialog : public QDialog, private Ui::QgsColorDialogBase bool mAllowOpacity = true; - /** - * Saves all dialog and widget settings - */ - void saveSettings(); - }; #endif // #ifndef QGSCOLORDIALOG_H diff --git a/src/gui/qgsmessageviewer.cpp b/src/gui/qgsmessageviewer.cpp index d9952ab71e5..16176df7d4f 100644 --- a/src/gui/qgsmessageviewer.cpp +++ b/src/gui/qgsmessageviewer.cpp @@ -17,11 +17,14 @@ #include "qgsmessageviewer.h" #include "qgssettings.h" +#include "qgsgui.h" QgsMessageViewer::QgsMessageViewer( QWidget *parent, Qt::WindowFlags fl, bool deleteOnClose ) : QDialog( parent, fl ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( checkBox, &QCheckBox::toggled, this, &QgsMessageViewer::checkBox_toggled ); if ( deleteOnClose ) { @@ -31,19 +34,10 @@ QgsMessageViewer::QgsMessageViewer( QWidget *parent, Qt::WindowFlags fl, bool de setCheckBoxVisible( false ); setCheckBoxState( Qt::Unchecked ); - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/MessageViewer/geometry" ) ).toByteArray() ); - txtMessage->setTextInteractionFlags( Qt::TextBrowserInteraction ); txtMessage->setOpenExternalLinks( true ); } -QgsMessageViewer::~QgsMessageViewer() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/MessageViewer/geometry" ), saveGeometry() ); -} - void QgsMessageViewer::setMessageAsHtml( const QString &msg ) { txtMessage->setHtml( msg ); diff --git a/src/gui/qgsmessageviewer.h b/src/gui/qgsmessageviewer.h index 845e19fa6b4..3286a2b9d87 100644 --- a/src/gui/qgsmessageviewer.h +++ b/src/gui/qgsmessageviewer.h @@ -34,7 +34,6 @@ class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, priv Q_OBJECT public: QgsMessageViewer( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, bool deleteOnClose = true ); - ~QgsMessageViewer() override; void setMessage( const QString &message, MessageType msgType ) override; diff --git a/src/gui/qgsnewmemorylayerdialog.cpp b/src/gui/qgsnewmemorylayerdialog.cpp index 2e2140fcbc6..aaaf6e45575 100644 --- a/src/gui/qgsnewmemorylayerdialog.cpp +++ b/src/gui/qgsnewmemorylayerdialog.cpp @@ -24,6 +24,7 @@ #include "qgsvectorlayer.h" #include "qgssettings.h" #include "qgsmemoryproviderutils.h" +#include "qgsgui.h" #include #include @@ -50,9 +51,7 @@ QgsNewMemoryLayerDialog::QgsNewMemoryLayerDialog( QWidget *parent, Qt::WindowFla : QDialog( parent, fl ) { setupUi( this ); - - QgsSettings settings; - restoreGeometry( settings.value( QStringLiteral( "Windows/NewMemoryLayer/geometry" ) ).toByteArray() ); + QgsGui::enableAutoGeometryRestore( this ); mGeometryTypeBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconTableLayer.svg" ) ), tr( "No geometry" ), QgsWkbTypes::NoGeometry ); mGeometryTypeBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPointLayer.svg" ) ), tr( "Point" ), QgsWkbTypes::Point ); @@ -72,12 +71,6 @@ QgsNewMemoryLayerDialog::QgsNewMemoryLayerDialog( QWidget *parent, Qt::WindowFla geometryTypeChanged( mGeometryTypeBox->currentIndex() ); } -QgsNewMemoryLayerDialog::~QgsNewMemoryLayerDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "Windows/NewMemoryLayer/geometry" ), saveGeometry() ); -} - QgsWkbTypes::Type QgsNewMemoryLayerDialog::selectedType() const { QgsWkbTypes::Type geomType = QgsWkbTypes::Unknown; diff --git a/src/gui/qgsnewmemorylayerdialog.h b/src/gui/qgsnewmemorylayerdialog.h index 68b09321acd..9fd2cea4142 100644 --- a/src/gui/qgsnewmemorylayerdialog.h +++ b/src/gui/qgsnewmemorylayerdialog.h @@ -47,7 +47,6 @@ class GUI_EXPORT QgsNewMemoryLayerDialog: public QDialog, private Ui::QgsNewMemo * New dialog constructor. */ QgsNewMemoryLayerDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags ); - ~QgsNewMemoryLayerDialog() override; //! Returns the selected geometry type QgsWkbTypes::Type selectedType() const; diff --git a/src/gui/qgssublayersdialog.cpp b/src/gui/qgssublayersdialog.cpp index 8a23b77415a..1a679d2eb0b 100644 --- a/src/gui/qgssublayersdialog.cpp +++ b/src/gui/qgssublayersdialog.cpp @@ -16,6 +16,7 @@ #include "qgssublayersdialog.h" #include "qgslogger.h" #include "qgssettings.h" +#include "qgsgui.h" #include #include @@ -47,6 +48,7 @@ QgsSublayersDialog::QgsSublayersDialog( ProviderType providerType, const QString , mName( name ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); if ( providerType == QgsSublayersDialog::Ogr ) { @@ -75,9 +77,6 @@ QgsSublayersDialog::QgsSublayersDialog( ProviderType providerType, const QString connect( button, &QAbstractButton::pressed, layersTable, &QTreeView::selectAll ); // connect( pbnSelectNone, SIGNAL( pressed() ), SLOT( layersTable->selectNone() ) ); - QgsSettings settings; - restoreGeometry( settings.value( "/Windows/" + mName + "SubLayers/geometry" ).toByteArray() ); - // Checkbox about adding sublayers to a group mCheckboxAddToGroup = new QCheckBox( tr( "Add layers to a group" ), this ); buttonBox->addButton( mCheckboxAddToGroup, QDialogButtonBox::ActionRole ); @@ -87,7 +86,6 @@ QgsSublayersDialog::QgsSublayersDialog( ProviderType providerType, const QString QgsSublayersDialog::~QgsSublayersDialog() { QgsSettings settings; - settings.setValue( "/Windows/" + mName + "SubLayers/geometry", saveGeometry() ); settings.setValue( "/Windows/" + mName + "SubLayers/headerState", layersTable->header()->saveState() ); } diff --git a/src/gui/qgssubstitutionlistwidget.cpp b/src/gui/qgssubstitutionlistwidget.cpp index d818ad7e450..b9c2512dc54 100644 --- a/src/gui/qgssubstitutionlistwidget.cpp +++ b/src/gui/qgssubstitutionlistwidget.cpp @@ -18,6 +18,8 @@ ***************************************************************************/ #include "qgssubstitutionlistwidget.h" +#include "qgsgui.h" + #include #include #include @@ -28,6 +30,8 @@ QgsSubstitutionListWidget::QgsSubstitutionListWidget( QWidget *parent ) : QgsPanelWidget( parent ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( mButtonAdd, &QToolButton::clicked, this, &QgsSubstitutionListWidget::mButtonAdd_clicked ); connect( mButtonRemove, &QToolButton::clicked, this, &QgsSubstitutionListWidget::mButtonRemove_clicked ); connect( mButtonExport, &QToolButton::clicked, this, &QgsSubstitutionListWidget::mButtonExport_clicked ); diff --git a/src/gui/symbology/qgsrendererpropertiesdialog.cpp b/src/gui/symbology/qgsrendererpropertiesdialog.cpp index 4de88f68865..39543feda5c 100644 --- a/src/gui/symbology/qgsrendererpropertiesdialog.cpp +++ b/src/gui/symbology/qgsrendererpropertiesdialog.cpp @@ -86,6 +86,7 @@ QgsRendererPropertiesDialog::QgsRendererPropertiesDialog( QgsVectorLayer *layer, { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); mLayerRenderingGroupBox->setSettingGroup( QStringLiteral( "layerRenderingGroupBox" ) ); // can be embedded in vector layer properties diff --git a/src/plugins/geometry_checker/qgsgeometrycheckerdialog.cpp b/src/plugins/geometry_checker/qgsgeometrycheckerdialog.cpp index 4c493d85c43..9e873e38923 100644 --- a/src/plugins/geometry_checker/qgsgeometrycheckerdialog.cpp +++ b/src/plugins/geometry_checker/qgsgeometrycheckerdialog.cpp @@ -20,6 +20,7 @@ #include "qgsgeometrychecker.h" #include "qgsfeaturepool.h" #include "qgssettings.h" +#include "qgsgui.h" #include #include @@ -30,9 +31,7 @@ QgsGeometryCheckerDialog::QgsGeometryCheckerDialog( QgisInterface *iface, QWidge mIface = iface; setWindowTitle( tr( "Check Geometries" ) ); - - QgsSettings s; - restoreGeometry( s.value( QStringLiteral( "/Plugin-GeometryChecker/Window/geometry" ) ).toByteArray() ); + QgsGui::enableAutoGeometryRestore( this ); mTabWidget = new QTabWidget(); mButtonBox = new QDialogButtonBox( QDialogButtonBox::Close | QDialogButtonBox::Help, Qt::Horizontal ); @@ -52,12 +51,6 @@ QgsGeometryCheckerDialog::QgsGeometryCheckerDialog( QgisInterface *iface, QWidge connect( dynamic_cast< QgsGeometryCheckerSetupTab * >( mTabWidget->widget( 0 ) ), &QgsGeometryCheckerSetupTab::checkerFinished, this, &QgsGeometryCheckerDialog::onCheckerFinished ); } -QgsGeometryCheckerDialog::~QgsGeometryCheckerDialog() -{ - QgsSettings s; - s.setValue( QStringLiteral( "/Plugin-GeometryChecker/Window/geometry" ), saveGeometry() ); -} - void QgsGeometryCheckerDialog::onCheckerStarted( QgsGeometryChecker *checker ) { delete mTabWidget->widget( 1 ); diff --git a/src/plugins/geometry_checker/qgsgeometrycheckerdialog.h b/src/plugins/geometry_checker/qgsgeometrycheckerdialog.h index a64b2f21bf6..259395c2b3c 100644 --- a/src/plugins/geometry_checker/qgsgeometrycheckerdialog.h +++ b/src/plugins/geometry_checker/qgsgeometrycheckerdialog.h @@ -34,7 +34,7 @@ class QgsGeometryCheckerDialog : public QDialog Q_OBJECT public: QgsGeometryCheckerDialog( QgisInterface *iface, QWidget *parent = nullptr ); - ~QgsGeometryCheckerDialog() override; + private: QgisInterface *mIface = nullptr; diff --git a/src/plugins/georeferencer/qgsgeorefconfigdialog.cpp b/src/plugins/georeferencer/qgsgeorefconfigdialog.cpp index 54a17a8e9df..0bf51dd574c 100644 --- a/src/plugins/georeferencer/qgsgeorefconfigdialog.cpp +++ b/src/plugins/georeferencer/qgsgeorefconfigdialog.cpp @@ -18,17 +18,17 @@ #include "qgssettings.h" #include "qgsgeorefconfigdialog.h" #include "qgis.h" +#include "qgsgui.h" QgsGeorefConfigDialog::QgsGeorefConfigDialog( QWidget *parent ) : QDialog( parent ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsGeorefConfigDialog::buttonBox_accepted ); connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsGeorefConfigDialog::buttonBox_rejected ); - QgsSettings s; - restoreGeometry( s.value( QStringLiteral( "/Plugin-GeoReferencer/ConfigWindow/geometry" ) ).toByteArray() ); - mPaperSizeComboBox->addItem( tr( "A5 (148x210 mm)" ), QSizeF( 148, 210 ) ); mPaperSizeComboBox->addItem( tr( "A4 (210x297 mm)" ), QSizeF( 210, 297 ) ); mPaperSizeComboBox->addItem( tr( "A3 (297x420 mm)" ), QSizeF( 297, 420 ) ); @@ -58,12 +58,6 @@ QgsGeorefConfigDialog::QgsGeorefConfigDialog( QWidget *parent ) readSettings(); } -QgsGeorefConfigDialog::~QgsGeorefConfigDialog() -{ - QgsSettings settings; - settings.setValue( QStringLiteral( "/Plugin-GeoReferencer/ConfigWindow/geometry" ), saveGeometry() ); -} - void QgsGeorefConfigDialog::changeEvent( QEvent *e ) { QDialog::changeEvent( e ); diff --git a/src/plugins/georeferencer/qgsgeorefconfigdialog.h b/src/plugins/georeferencer/qgsgeorefconfigdialog.h index 41d80fcabf6..1e3c84585e7 100644 --- a/src/plugins/georeferencer/qgsgeorefconfigdialog.h +++ b/src/plugins/georeferencer/qgsgeorefconfigdialog.h @@ -23,7 +23,6 @@ class QgsGeorefConfigDialog : public QDialog, private Ui::QgsGeorefConfigDialogB Q_OBJECT public: explicit QgsGeorefConfigDialog( QWidget *parent = nullptr ); - ~QgsGeorefConfigDialog() override; protected: void changeEvent( QEvent *e ) override; diff --git a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp index dde126de314..51ef3fd725d 100644 --- a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp +++ b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp @@ -20,6 +20,7 @@ #include "qgsmapcoordsdialog.h" #include "qgssettings.h" #include "qgsmapmouseevent.h" +#include "qgsgui.h" QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPointXY &pixelCoords, QWidget *parent ) : QDialog( parent, Qt::Dialog ) @@ -27,10 +28,9 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint , mPixelCoords( pixelCoords ) { setupUi( this ); - connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsMapCoordsDialog::buttonBox_accepted ); + QgsGui::enableAutoGeometryRestore( this ); - QgsSettings s; - restoreGeometry( s.value( QStringLiteral( "/Plugin-GeoReferencer/MapCoordsWindow/geometry" ) ).toByteArray() ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsMapCoordsDialog::buttonBox_accepted ); setAttribute( Qt::WA_DeleteOnClose ); @@ -46,7 +46,8 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint mToolEmitPoint = new QgsGeorefMapToolEmitPoint( qgisCanvas ); mToolEmitPoint->setButton( mPointFromCanvasPushButton ); - mMinimizeWindowCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/Minimize" ), QStringLiteral( "1" ) ).toBool() ); + QgsSettings settings; + mMinimizeWindowCheckBox->setChecked( settings.value( QStringLiteral( "/Plugin-GeoReferencer/Config/Minimize" ), QStringLiteral( "1" ) ).toBool() ); connect( mPointFromCanvasPushButton, &QAbstractButton::clicked, this, &QgsMapCoordsDialog::setToolEmitPoint ); @@ -64,7 +65,6 @@ QgsMapCoordsDialog::~QgsMapCoordsDialog() delete mToolEmitPoint; QgsSettings settings; - settings.setValue( QStringLiteral( "/Plugin-GeoReferencer/MapCoordsWindow/geometry" ), saveGeometry() ); settings.setValue( QStringLiteral( "/Plugin-GeoReferencer/Config/Minimize" ), mMinimizeWindowCheckBox->isChecked() ); } diff --git a/src/plugins/offline_editing/offline_editing_plugin_gui.cpp b/src/plugins/offline_editing/offline_editing_plugin_gui.cpp index 77c15adeb41..fad3b52743c 100644 --- a/src/plugins/offline_editing/offline_editing_plugin_gui.cpp +++ b/src/plugins/offline_editing/offline_editing_plugin_gui.cpp @@ -27,6 +27,7 @@ #include "qgsvectorlayer.h" #include "qgssettings.h" #include "qgsapplication.h" +#include "qgsgui.h" #include #include @@ -99,6 +100,8 @@ QgsOfflineEditingPluginGui::QgsOfflineEditingPluginGui( QWidget *parent, Qt::Win : QDialog( parent, fl ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( mBrowseButton, &QPushButton::clicked, this, &QgsOfflineEditingPluginGui::mBrowseButton_clicked ); connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsOfflineEditingPluginGui::buttonBox_accepted ); connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsOfflineEditingPluginGui::buttonBox_rejected ); @@ -122,7 +125,6 @@ QgsOfflineEditingPluginGui::QgsOfflineEditingPluginGui( QWidget *parent, Qt::Win QgsOfflineEditingPluginGui::~QgsOfflineEditingPluginGui() { QgsSettings settings; - settings.setValue( QStringLiteral( "OfflineEditing/geometry" ), saveGeometry(), QgsSettings::Section::Plugins ); settings.setValue( QStringLiteral( "OfflineEditing/offline_data_path" ), mOfflineDataPath, QgsSettings::Section::Plugins ); } @@ -246,7 +248,6 @@ void QgsOfflineEditingPluginGui::restoreState() { QgsSettings settings; mOfflineDataPath = settings.value( QStringLiteral( "OfflineEditing/offline_data_path" ), QDir::homePath(), QgsSettings::Section::Plugins ).toString(); - restoreGeometry( settings.value( QStringLiteral( "OfflineEditing/geometry" ), QgsSettings::Section::Plugins ).toByteArray() ); } void QgsOfflineEditingPluginGui::selectAll() diff --git a/src/providers/wms/qgstilescalewidget.cpp b/src/providers/wms/qgstilescalewidget.cpp index 0b68601a2bb..f6b53c8c090 100644 --- a/src/providers/wms/qgstilescalewidget.cpp +++ b/src/providers/wms/qgstilescalewidget.cpp @@ -23,6 +23,7 @@ #include "qgslogger.h" #include "qgsdockwidget.h" #include "qgssettings.h" +#include "qgsgui.h" #include "layertree/qgslayertreeview.h" #include @@ -35,6 +36,7 @@ QgsTileScaleWidget::QgsTileScaleWidget( QgsMapCanvas *mapCanvas, QWidget *parent , mMapCanvas( mapCanvas ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); connect( mSlider, &QSlider::valueChanged, this, &QgsTileScaleWidget::mSlider_valueChanged ); connect( mMapCanvas, &QgsMapCanvas::scaleChanged, this, &QgsTileScaleWidget::scaleChanged ); diff --git a/src/providers/wms/qgswmssourceselect.cpp b/src/providers/wms/qgswmssourceselect.cpp index 4ba7ea987f8..126282c91f3 100644 --- a/src/providers/wms/qgswmssourceselect.cpp +++ b/src/providers/wms/qgswmssourceselect.cpp @@ -37,6 +37,7 @@ #include "qgswmscapabilities.h" #include "qgsapplication.h" #include "qgssettings.h" +#include "qgsgui.h" #include #include @@ -58,6 +59,8 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs , mDefaultCRS( GEO_EPSG_CRS_AUTHID ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); + connect( btnNew, &QPushButton::clicked, this, &QgsWMSSourceSelect::btnNew_clicked ); connect( btnEdit, &QPushButton::clicked, this, &QgsWMSSourceSelect::btnEdit_clicked ); connect( btnDelete, &QPushButton::clicked, this, &QgsWMSSourceSelect::btnDelete_clicked ); @@ -144,17 +147,8 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs // set up the WMS connections we already know about populateConnectionList(); - QgsSettings settings; - QgsDebugMsg( QStringLiteral( "restoring geometry" ) ); - restoreGeometry( settings.value( QStringLiteral( "Windows/WMSSourceSelect/geometry" ) ).toByteArray() ); } -QgsWMSSourceSelect::~QgsWMSSourceSelect() -{ - QgsSettings settings; - QgsDebugMsg( QStringLiteral( "saving geometry" ) ); - settings.setValue( QStringLiteral( "Windows/WMSSourceSelect/geometry" ), saveGeometry() ); -} void QgsWMSSourceSelect::refresh() { diff --git a/src/providers/wms/qgswmssourceselect.h b/src/providers/wms/qgswmssourceselect.h index 798b818be6f..bf4168d72f7 100644 --- a/src/providers/wms/qgswmssourceselect.h +++ b/src/providers/wms/qgswmssourceselect.h @@ -51,8 +51,6 @@ class QgsWMSSourceSelect : public QgsAbstractDataSourceWidget, private Ui::QgsWM //! Constructor QgsWMSSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None ); - ~QgsWMSSourceSelect() override; - public slots: //! Triggered when the provider's connections need to be refreshed diff --git a/src/providers/wms/qgswmtsdimensions.cpp b/src/providers/wms/qgswmtsdimensions.cpp index 8268a8716d7..6cc4702a80a 100644 --- a/src/providers/wms/qgswmtsdimensions.cpp +++ b/src/providers/wms/qgswmtsdimensions.cpp @@ -18,6 +18,7 @@ #include "qgswmsprovider.h" #include "qgswmtsdimensions.h" #include "qgssettings.h" +#include "qgsgui.h" #include @@ -46,17 +47,7 @@ QgsWmtsDimensions::QgsWmtsDimensions( const QgsWmtsTileLayer &layer, QWidget *pa cb->setCurrentIndex( idx < 0 ? 0 : idx ); mDimensions->setCellWidget( i, 4, cb ); } - - QgsSettings settings; - QgsDebugMsg( QStringLiteral( "restoring geometry" ) ); - restoreGeometry( settings.value( QStringLiteral( "Windows/WMTSDimensions/geometry" ) ).toByteArray() ); -} - -QgsWmtsDimensions::~QgsWmtsDimensions() -{ - QgsSettings settings; - QgsDebugMsg( QStringLiteral( "saving geometry" ) ); - settings.setValue( QStringLiteral( "Windows/WmtsDimensions/geometry" ), saveGeometry() ); + QgsGui::enableAutoGeometryRestore( this ); } void QgsWmtsDimensions::selectedDimensions( QHash &selected ) diff --git a/src/providers/wms/qgswmtsdimensions.h b/src/providers/wms/qgswmtsdimensions.h index b538033d831..e4af877181d 100644 --- a/src/providers/wms/qgswmtsdimensions.h +++ b/src/providers/wms/qgswmtsdimensions.h @@ -38,8 +38,6 @@ class QgsWmtsDimensions : public QDialog, private Ui::QgsWmtsDimensionsBase //! Constructor QgsWmtsDimensions( const QgsWmtsTileLayer &layer, QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr ); - ~QgsWmtsDimensions() override; - void selectedDimensions( QHash &dims ); }; diff --git a/src/providers/wms/qgsxyzconnectiondialog.cpp b/src/providers/wms/qgsxyzconnectiondialog.cpp index 85234b41def..107387d0a89 100644 --- a/src/providers/wms/qgsxyzconnectiondialog.cpp +++ b/src/providers/wms/qgsxyzconnectiondialog.cpp @@ -15,11 +15,13 @@ #include "qgsxyzconnectiondialog.h" #include "qgsxyzconnection.h" +#include "qgsgui.h" QgsXyzConnectionDialog::QgsXyzConnectionDialog( QWidget *parent ) : QDialog( parent ) { setupUi( this ); + QgsGui::enableAutoGeometryRestore( this ); // Behavior for min and max zoom checkbox connect( mCheckBoxZMin, &QCheckBox::toggled, mSpinZMin, &QSpinBox::setEnabled );