QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
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 (QgsBrowserGuiModel *browserModel=nullptr, bool setFilterByLayerType=false, Qgis::LayerType layerType=Qgis::LayerType::Vector, QWidget *parent=nullptr)
 Constructs a QgsDataSourceSelectDialog, optionally filtering by layer type.
 
void expandPath (const QString &path, bool selectPath=false)
 Expands out a file path in the view.
 
void setCaseSensitive (bool caseSensitive)
 Sets filter case sensitivity.
 
void setDescription (const QString &description)
 Sets a description label.
 
void setFilter ()
 Apply filter to the model.
 
void setFilterSyntax (QAction *)
 Sets filter syntax.
 
void setLayerTypeFilter (Qgis::LayerType layerType)
 Sets layer type filter to layerType and activates the filtering.
 
void showFilterWidget (bool visible)
 Show/hide filter widget.
 
QgsMimeDataUtils::Uri uri () const
 Returns the (possibly invalid) uri of the selected data source.
 

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 169 of file qgsdatasourceselectdialog.h.

Constructor & Destructor Documentation

◆ QgsDataSourceSelectDialog()

QgsDataSourceSelectDialog::QgsDataSourceSelectDialog ( QgsBrowserGuiModel browserModel = nullptr,
bool  setFilterByLayerType = false,
Qgis::LayerType  layerType = Qgis::LayerType::Vector,
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 375 of file qgsdatasourceselectdialog.cpp.

Member Function Documentation

◆ expandPath()

void QgsDataSourceSelectDialog::expandPath ( const QString &  path,
bool  selectPath = false 
)

Expands out a file path in the view.

The path must correspond to a valid directory existing on the file system.

Since QGIS 3.38 the selectPath argument can be used to automatically select the path too.

Since
QGIS 3.28

Definition at line 411 of file qgsdatasourceselectdialog.cpp.

◆ setCaseSensitive()

void QgsDataSourceSelectDialog::setCaseSensitive ( bool  caseSensitive)

Sets filter case sensitivity.

Definition at line 431 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
QGIS 3.8

Definition at line 406 of file qgsdatasourceselectdialog.cpp.

◆ setFilter()

void QgsDataSourceSelectDialog::setFilter ( )

Apply filter to the model.

Definition at line 436 of file qgsdatasourceselectdialog.cpp.

◆ setFilterSyntax()

void QgsDataSourceSelectDialog::setFilterSyntax ( QAction *  syntax)

Sets filter syntax.

Definition at line 426 of file qgsdatasourceselectdialog.cpp.

◆ setLayerTypeFilter()

void QgsDataSourceSelectDialog::setLayerTypeFilter ( Qgis::LayerType  layerType)

Sets layer type filter to layerType and activates the filtering.

Definition at line 401 of file qgsdatasourceselectdialog.cpp.

◆ showFilterWidget()

void QgsDataSourceSelectDialog::showFilterWidget ( bool  visible)

Show/hide filter widget.

Definition at line 421 of file qgsdatasourceselectdialog.cpp.

◆ uri()

QgsMimeDataUtils::Uri QgsDataSourceSelectDialog::uri ( ) const

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

Definition at line 416 of file qgsdatasourceselectdialog.cpp.


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