QGIS API Documentation  3.8.0-Zanzibar (11aff65)
Public Member Functions | List of all members
QgsDataSourceSelectDialog Class Reference

The QgsDataSourceSelectDialog class embeds the browser view to select an existing data source. More...

#include <qgsdatasourceselectdialog.h>

Inheritance diagram for QgsDataSourceSelectDialog:
Inheritance graph
[legend]

Public Member Functions

 QgsDataSourceSelectDialog (QgsBrowserModel *browserModel=nullptr, bool setFilterByLayerType=false, QgsMapLayerType layerType=QgsMapLayerType::VectorLayer, QWidget *parent=nullptr)
 Constructs a QgsDataSourceSelectDialog, optionally filtering by layer type. More...
 
 ~QgsDataSourceSelectDialog () override
 
void setCaseSensitive (bool caseSensitive)
 Sets filter case sensitivity. More...
 
void setDescription (const QString &description)
 Sets a description label. More...
 
void setFilter ()
 Apply filter to the model. More...
 
void setFilterSyntax (QAction *)
 Sets filter syntax. More...
 
void setLayerTypeFilter (QgsMapLayerType layerType)
 Sets layer type filter to layerType and activates the filtering. More...
 
void showEvent (QShowEvent *e) override
 Scroll to last selected index and expand it's children. More...
 
void showFilterWidget (bool visible)
 Show/hide filter widget. More...
 
QgsMimeDataUtils::Uri uri () const
 Returns the (possibly invalid) uri of the selected data source. More...
 

Detailed Description

The QgsDataSourceSelectDialog class embeds the browser view to select an existing data source.

By default any layer type can be chosen, the valid layer type can be restricted by setting a layer type filter with setLayerTypeFilter(layerType) or by activating the filter directly from the constructor.

To retrieve the selected data source, uri() can be called and it will return a (possibly invalid) QgsMimeDataUtils::Uri.

Since
QGIS 3.6

Definition at line 45 of file qgsdatasourceselectdialog.h.

Constructor & Destructor Documentation

◆ QgsDataSourceSelectDialog()

QgsDataSourceSelectDialog::QgsDataSourceSelectDialog ( QgsBrowserModel browserModel = nullptr,
bool  setFilterByLayerType = false,
QgsMapLayerType  layerType = QgsMapLayerType::VectorLayer,
QWidget *  parent = nullptr 
)

Constructs a QgsDataSourceSelectDialog, optionally filtering by layer type.

Parameters
browserModelan existing browser model (typically from app), if nullptr an instance will be created
setFilterByLayerTypeactivates filtering by layer type
layerTypesets the layer type filter, this is in effect only if filtering by layer type is also active
parentthe object

Definition at line 29 of file qgsdatasourceselectdialog.cpp.

◆ ~QgsDataSourceSelectDialog()

QgsDataSourceSelectDialog::~QgsDataSourceSelectDialog ( )
override

Definition at line 119 of file qgsdatasourceselectdialog.cpp.

Member Function Documentation

◆ setCaseSensitive()

void QgsDataSourceSelectDialog::setCaseSensitive ( bool  caseSensitive)

Sets filter case sensitivity.

Definition at line 245 of file qgsdatasourceselectdialog.cpp.

◆ setDescription()

void QgsDataSourceSelectDialog::setDescription ( const QString &  description)

Sets a description label.

Parameters
descriptiona description string
Note
the description will be displayed at the bottom of the dialog
Since
3.8

Definition at line 166 of file qgsdatasourceselectdialog.cpp.

◆ setFilter()

void QgsDataSourceSelectDialog::setFilter ( )

Apply filter to the model.

Definition at line 190 of file qgsdatasourceselectdialog.cpp.

◆ setFilterSyntax()

void QgsDataSourceSelectDialog::setFilterSyntax ( QAction *  action)

Sets filter syntax.

Definition at line 238 of file qgsdatasourceselectdialog.cpp.

◆ setLayerTypeFilter()

void QgsDataSourceSelectDialog::setLayerTypeFilter ( QgsMapLayerType  layerType)

Sets layer type filter to layerType and activates the filtering.

Definition at line 250 of file qgsdatasourceselectdialog.cpp.

◆ showEvent()

void QgsDataSourceSelectDialog::showEvent ( QShowEvent *  e)
override

Scroll to last selected index and expand it's children.

Definition at line 126 of file qgsdatasourceselectdialog.cpp.

◆ showFilterWidget()

void QgsDataSourceSelectDialog::showFilterWidget ( bool  visible)

Show/hide filter widget.

Definition at line 151 of file qgsdatasourceselectdialog.cpp.

◆ uri()

QgsMimeDataUtils::Uri QgsDataSourceSelectDialog::uri ( ) const

Returns the (possibly invalid) uri of the selected data source.

Definition at line 259 of file qgsdatasourceselectdialog.cpp.


The documentation for this class was generated from the following files: