Skip to content

Commit

Permalink
Small cleanups for QgsDataSourceSelectDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 5, 2018
1 parent ea9d5bb commit bac5fbb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
4 changes: 1 addition & 3 deletions python/gui/auto_generated/qgsdatasourceselectdialog.sip.in
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions src/gui/qgsdatasourceselectdialog.cpp
Expand Up @@ -17,6 +17,7 @@
#include "qgsdatasourceselectdialog.h"
#include "ui_qgsdatasourceselectdialog.h"
#include "qgssettings.h"
#include "qgsgui.h"
#include "qgis.h"

#include <QPushButton>
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down
4 changes: 1 addition & 3 deletions src/gui/qgsdatasourceselectdialog.h
Expand Up @@ -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
Expand Down

0 comments on commit bac5fbb

Please sign in to comment.