QgsDataSourceSelectDialog class
The QgsDataSourceSelectDialog class embeds the browser view to select an existing data source.
Contents
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::
Constructors, destructors, conversion operators
-
QgsDataSourceSelectDialog(QgsBrowserModel* browserModel = nullptr,
bool setFilterByLayerType = false,
const QgsMapLayer::
LayerType& layerType = QgsMapLayer::LayerType::VectorLayer, QWidget* parent = nullptr) - Constructs a QgsDataSourceSelectDialog, optionally filtering by layer type.
Public functions
- void setCaseSensitive(bool caseSensitive)
- Sets filter case sensitivity.
- void setFilter()
- Apply filter to the model.
- void setFilterSyntax(QAction*)
- Sets filter syntax.
-
void setLayerTypeFilter(QgsMapLayer::
LayerType layerType) - Sets layer type filter to layerType and activates the filtering.
- void showEvent(QShowEvent* e) override
- Scroll to last selected index and expand it's children.
- void showFilterWidget(bool visible)
- Show/hide filter widget.
-
auto uri() const -> QgsMimeDataUtils::
Uri - Returns the (possibly invalid) uri of the selected data source.
Function documentation
QgsDataSourceSelectDialog:: QgsDataSourceSelectDialog(QgsBrowserModel* browserModel = nullptr,
bool setFilterByLayerType = false,
const QgsMapLayer:: LayerType& layerType = QgsMapLayer::LayerType::VectorLayer,
QWidget* parent = nullptr)
Constructs a QgsDataSourceSelectDialog, optionally filtering by layer type.
| Parameters | |
|---|---|
| browserModel | an existing browser model (typically from app), if null an instance will be created |
| setFilterByLayerType | activates filtering by layer type |
| layerType | sets the layer type filter, this is in effect only if filtering by layer type is also active |
| parent | the object |