From bac5fbbe0d7e2c1e5f018ec1bff55d0aa80f3259 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 5 Nov 2018 16:51:31 +1000 Subject: [PATCH] Small cleanups for QgsDataSourceSelectDialog --- .../qgsdatasourceselectdialog.sip.in | 4 +--- src/gui/qgsdatasourceselectdialog.cpp | 14 ++++---------- src/gui/qgsdatasourceselectdialog.h | 4 +--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/python/gui/auto_generated/qgsdatasourceselectdialog.sip.in b/python/gui/auto_generated/qgsdatasourceselectdialog.sip.in index 08f396e2b4e7..efe3b2a77a74 100644 --- a/python/gui/auto_generated/qgsdatasourceselectdialog.sip.in +++ b/python/gui/auto_generated/qgsdatasourceselectdialog.sip.in @@ -42,9 +42,7 @@ Constructs a QgsDataSourceSelectDialog, optionally filtering by layer type :param parent: the object %End - ~QgsDataSourceSelectDialog(); - - void setLayerTypeFilter( const QgsMapLayer::LayerType &layerType ); + void setLayerTypeFilter( QgsMapLayer::LayerType layerType ); %Docstring Sets layer type filter to ``layerType`` and activates the filtering %End diff --git a/src/gui/qgsdatasourceselectdialog.cpp b/src/gui/qgsdatasourceselectdialog.cpp index 562ee3e8b687..ceec66a5b13a 100644 --- a/src/gui/qgsdatasourceselectdialog.cpp +++ b/src/gui/qgsdatasourceselectdialog.cpp @@ -17,6 +17,7 @@ #include "qgsdatasourceselectdialog.h" #include "ui_qgsdatasourceselectdialog.h" #include "qgssettings.h" +#include "qgsgui.h" #include "qgis.h" #include @@ -27,9 +28,8 @@ QgsDataSourceSelectDialog::QgsDataSourceSelectDialog( bool setFilterByLayerType, : QDialog( parent ) { setupUi( this ); - setWindowTitle( tr( "Select a data source" ) ); - QByteArray dlgGeom( QgsSettings().value( QStringLiteral( "/Windows/selectDataSourceDialog/geometry" ), QVariant(), QgsSettings::Section::Gui ).toByteArray() ); - restoreGeometry( dlgGeom ); + setWindowTitle( tr( "Select a Data Source" ) ); + QgsGui::enableAutoGeometryRestore( this ); mBrowserModel.initialize(); mBrowserProxyModel.setBrowserModel( &mBrowserModel ); @@ -47,13 +47,7 @@ QgsDataSourceSelectDialog::QgsDataSourceSelectDialog( bool setFilterByLayerType, connect( mBrowserTreeView, &QgsBrowserTreeView::clicked, this, &QgsDataSourceSelectDialog::onLayerSelected ); } - -QgsDataSourceSelectDialog::~QgsDataSourceSelectDialog() -{ - QgsSettings().setValue( QStringLiteral( "/Windows/selectDataSourceDialog/geometry" ), saveGeometry(), QgsSettings::Section::Gui ); -} - -void QgsDataSourceSelectDialog::setLayerTypeFilter( const QgsMapLayer::LayerType &layerType ) +void QgsDataSourceSelectDialog::setLayerTypeFilter( QgsMapLayer::LayerType layerType ) { mBrowserProxyModel.setFilterByLayerType( true ); mBrowserProxyModel.setLayerType( layerType ); diff --git a/src/gui/qgsdatasourceselectdialog.h b/src/gui/qgsdatasourceselectdialog.h index ca19232dfb22..5c57b70d711a 100644 --- a/src/gui/qgsdatasourceselectdialog.h +++ b/src/gui/qgsdatasourceselectdialog.h @@ -58,12 +58,10 @@ class GUI_EXPORT QgsDataSourceSelectDialog: public QDialog, private Ui::QgsDataS const QgsMapLayer::LayerType &layerType = QgsMapLayer::LayerType::VectorLayer, QWidget *parent = nullptr ); - ~QgsDataSourceSelectDialog() override; - /** * Sets layer type filter to \a layerType and activates the filtering */ - void setLayerTypeFilter( const QgsMapLayer::LayerType &layerType ); + void setLayerTypeFilter( QgsMapLayer::LayerType layerType ); /** * Returns the (possibly invalid) uri of the selected data source