Class: QgsAbstractDataSourceWidget¶
Abstract base Data Source Widget to create connections and add layers This class provides common functionality and the interface for all source select dialogs used by data providers to configure data sources and add layers.
The implementation is generic enough to handle other layer search and selection widgets.
Class Hierarchy¶
Base classes¶
Subclasses¶
The |
|
The |
|
Dialog to create connections and add layers WCS etc. |
Methods
Returns the add Button |
|
Triggered when the add button is clicked, the add layer signal is emitted Concrete classes should implement the right behavior depending on the layer being added. |
|
Returns the associated browser model (may be |
|
Configure the widget from a layer uri by selecting the layer path or connection options. |
|
Returns the dialog map canvas |
|
Triggered when the provider's connections need to be refreshed The default implementation does nothing |
|
Called when this source select widget is being shown in a "new and clean" dialog. |
|
Sets a browser model to use with the widget. |
|
Sets the dialog map canvas |
|
Connect the ok and apply/add buttons to the slots |
|
Returns the widget mode |
Signals
Emitted when a DB layer has been selected for addition |
|
Emitted when a layer has been selected for addition. |
|
Emitted when a mesh layer has been selected for addition. |
|
Emitted when a point cloud layer has been selected for addition. |
|
Emitted when a raster layer has been selected for addition |
|
Emitted when one or more GDAL supported layers are selected for addition |
|
Emitted when a vector layer has been selected for addition. |
|
Emitted when one or more OGR supported layers are selected for addition |
|
Emitted when a vector tile layer has been selected for addition. |
|
Emitted when the provider's connections have changed This signal is normally forwarded the app and used to refresh browser items |
|
Emitted when the ok/add buttons should be enabled/disabled |
|
Emitted when a progress dialog is shown by the provider dialog. |
|
Emitted when a progress dialog is shown by the provider dialog |
|
Emitted when a message with title and level must be shown to the user using the parent visible message bar |
|
Emitted when a layer needs to be replaced |
- class qgis.gui.QgsAbstractDataSourceWidget[source]¶
Bases:
QDialog
- __init__(parent: QWidget | None = None, fl: Qt.WindowFlags | Qt.WindowType = QgsGuiUtils.ModalDialogFlags, widgetMode: QgsProviderRegistry.WidgetMode = QgsProviderRegistry.WidgetMode.Standalone)
Constructor
- Parameters:
parent (Optional[QWidget] = None)
fl (Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags)
widgetMode (QgsProviderRegistry.WidgetMode = QgsProviderRegistry.WidgetMode.Standalone)
- addButton(self) QPushButton | None [source]¶
Returns the add Button
- Return type:
Optional[QPushButton]
- addButtonClicked(self)[source]¶
Triggered when the add button is clicked, the add layer signal is emitted Concrete classes should implement the right behavior depending on the layer being added.
- signal addDatabaseLayers(paths: List[str], providerKey: str)[source]¶
Emitted when a DB layer has been selected for addition
- Parameters:
paths (List[str])
providerKey (str)
- signal addLayer(type: Qgis.LayerType, url: str, baseName: str, providerKey: str)[source]¶
Emitted when a layer has been selected for addition.
This is a generic method, intended for replacing the specific layer type signals implemented above.
Warning
For QGIS versions < 4.x, the specific layer type added signals must be emitted for vector, raster, mesh, vector tile and point cloud layers in addition to this signal.
Added in version 3.34.
- Parameters:
type (Qgis.LayerType)
url (str)
baseName (str)
providerKey (str)
- signal addMeshLayer[source]¶
Emitted when a mesh layer has been selected for addition.
Deprecated since version 3.40: Use
addLayer()
instead.
- signal addPointCloudLayer[source]¶
Emitted when a point cloud layer has been selected for addition.
Deprecated since version 3.40: Use
addLayer()
instead.
- signal addRasterLayer[source]¶
Emitted when a raster layer has been selected for addition
Deprecated since version 3.40: Use
addLayer()
instead.
- signal addRasterLayers(layersList: List[str])[source]¶
Emitted when one or more GDAL supported layers are selected for addition
- Parameters:
layersList (List[str]) – list of layers protocol URIs
Added in version 3.20.
- signal addVectorLayer[source]¶
Emitted when a vector layer has been selected for addition.
If
providerKey
is not specified, the default provider key associated with the source will be used.Deprecated since version 3.40: Use
addLayer()
instead.
- signal addVectorLayers(layerList: List[str], encoding: str, dataSourceType: str)[source]¶
Emitted when one or more OGR supported layers are selected for addition
- Parameters:
layerList (List[str]) – list of layers protocol URIs
encoding (str) – encoding
dataSourceType (str) – string (can be “file” or “database”)
- signal addVectorTileLayer[source]¶
Emitted when a vector tile layer has been selected for addition.
Deprecated since version 3.40: Use
addLayer()
instead.
- browserModel(self) QgsBrowserModel | None [source]¶
Returns the associated browser model (may be
None
).Added in version 3.18.
- Return type:
Optional[QgsBrowserModel]
- configureFromUri(self, uri: str | None) bool [source]¶
Configure the widget from a layer
uri
by selecting the layer path or connection options. The base implementation does nothing and returnsFalse
: providers with ConfigureSourceSelectFromUri capability must override to implement this functionality.- Return type:
bool
- Returns:
True
on success.
Note
Not all data providers may be able to configure the widget from the provided uri, in that case this method returns
False
.Added in version 3.38.
- Parameters:
uri (Optional[str])
- signal connectionsChanged[source]¶
Emitted when the provider’s connections have changed This signal is normally forwarded the app and used to refresh browser items
- signal enableButtons(enable: bool)[source]¶
Emitted when the ok/add buttons should be enabled/disabled
- Parameters:
enable (bool)
- mapCanvas(self) QgsMapCanvas | None [source]¶
Returns the dialog map canvas
See also
- Return type:
Optional[QgsMapCanvas]
- signal progress[source]¶
Emitted when a progress dialog is shown by the provider dialog.
Deprecated since version 3.4: This signal is no longer used. Use
QgsProxyProgressTask
instead to show progress reports.
- signal progressMessage(message: str)[source]¶
Emitted when a progress dialog is shown by the provider dialog
- Parameters:
message (str)
- signal pushMessage(title: str, message: str, level: Qgis.MessageLevel = Qgis.MessageLevel.Info)[source]¶
Emitted when a
message
withtitle
andlevel
must be shown to the user using the parent visible message barAdded in version 3.14.
- Parameters:
title (str)
message (str)
level (Qgis.MessageLevel = Qgis.MessageLevel.Info)
- refresh(self)[source]¶
Triggered when the provider’s connections need to be refreshed The default implementation does nothing
- signal replaceVectorLayer(oldId: str, source: str, name: str, provider: str)[source]¶
Emitted when a layer needs to be replaced
- Parameters:
oldId (str) – old layer ID
source (str) – URI of the layer
name (str) – of the layer
provider (str) – key
- reset(self)[source]¶
Called when this source select widget is being shown in a “new and clean” dialog.
The data source manager recycles existing source select widgets but will call this method on every reopening. This should clear any selection that has previously been done.
Added in version 3.10.
- setBrowserModel(self, model: QgsBrowserModel | None)[source]¶
Sets a browser
model
to use with the widget.See also
Added in version 3.18.
- Parameters:
model (Optional[QgsBrowserModel])
- setMapCanvas(self, mapCanvas: QgsMapCanvas | None)[source]¶
Sets the dialog map canvas
See also
- Parameters:
mapCanvas (Optional[QgsMapCanvas])
- setupButtons(self, buttonBox: QDialogButtonBox | None)[source]¶
Connect the ok and apply/add buttons to the slots
- Parameters:
buttonBox (Optional[QDialogButtonBox])
- widgetMode(self) QgsProviderRegistry.WidgetMode [source]¶
Returns the widget mode
- Return type: