Skip to content
Permalink
Browse files

Small cleanups for QgsDataSourceSelectDialog

  • Loading branch information
nyalldawson committed Nov 5, 2018
1 parent ea9d5bb commit bac5fbbe0d7e2c1e5f018ec1bff55d0aa80f3259
@@ -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
@@ -17,6 +17,7 @@
#include "qgsdatasourceselectdialog.h"
#include "ui_qgsdatasourceselectdialog.h"
#include "qgssettings.h"
#include "qgsgui.h"
#include "qgis.h"

#include <QPushButton>
@@ -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 );
@@ -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

0 comments on commit bac5fbb

Please sign in to comment.
You can’t perform that action at this time.