Class: QgsDataSourceSelectWidget¶
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.
Added in version 3.14.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Base class for any widget that can be shown as an inline panel. |
|
Methods
Expands out a file path in the view. |
|
Sets filter case sensitivity |
|
Sets a description label |
|
Apply filter to the model |
|
Sets filter syntax |
|
Sets layer type filter to layerType and activates the filtering |
|
Show/hide filter widget |
|
Returns the (possibly invalid) uri of the selected data source |
Virtual Methods
In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsDataSourceSelectWidget. See the FAQ for more details.
Scroll to last selected index and expand it's children |
Signals
Emitted when an item is triggered, e.g. via a double-click. |
|
Emitted when the current selection changes in the widget. |
|
This signal is emitted whenever the validation status of the widget changes. |
- class qgis.gui.QgsDataSourceSelectWidget[source]¶
Bases:
QgsPanelWidget- __init__(browserModel: QgsBrowserGuiModel | None = None, setFilterByLayerType: bool = False, layerType: Qgis.LayerType = Qgis.LayerType.Vector, parent: QWidget | None = None)
Constructs a QgsDataSourceSelectWidget, optionally filtering by layer type
- Parameters:
browserModel (Optional[QgsBrowserGuiModel] = None) – an existing browser model (typically from app), if
Nonean instance will be createdsetFilterByLayerType (bool = False) – activates filtering by layer type
layerType (Qgis.LayerType = Qgis.LayerType.Vector) – sets the layer type filter, this is in effect only if filtering by layer type is also active
parent (Optional[QWidget] = None) – the object
- expandPath(self, path: str | None, selectPath: bool = False)[source]¶
Expands out a file
pathin the view.The
pathmust correspond to a valid directory existing on the file system.Since QGIS 3.38 the
selectPathargument can be used to automatically select the path too.Added in version 3.28.
- Parameters:
path (Optional[str])
selectPath (bool = False)
- signal itemTriggered(uri: QgsMimeDataUtils.Uri)[source]¶
Emitted when an item is triggered, e.g. via a double-click.
- Parameters:
uri (QgsMimeDataUtils.Uri)
- setCaseSensitive(self, caseSensitive: bool)[source]¶
Sets filter case sensitivity
- Parameters:
caseSensitive (bool)
- setDescription(self, description: str | None)[source]¶
Sets a description label
- Parameters:
description (Optional[str]) – a description string
Note
the description will be displayed at the bottom of the dialog
Added in version 3.8.
- setFilterSyntax(self, a0: QAction | None)[source]¶
Sets filter syntax
- Parameters:
a0 (Optional[QAction])
- setLayerTypeFilter(self, layerType: Qgis.LayerType)[source]¶
Sets layer type filter to
layerTypeand activates the filtering- Parameters:
layerType (Qgis.LayerType)
- virtual showEvent(self, e: QShowEvent | None)[source]¶
Scroll to last selected index and expand it’s children
- Parameters:
e (Optional[QShowEvent])
- uri(self) QgsMimeDataUtils.Uri[source]¶
Returns the (possibly invalid) uri of the selected data source
- Return type: