Class: QgsAbstractDataSourceWidget

class qgis.gui.QgsAbstractDataSourceWidget(parent: QWidget = None, fl: Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags, widgetMode: QgsProviderRegistry.WidgetMode = QgsProviderRegistry.WidgetMode.None)

Bases: PyQt5.QtWidgets.QDialog

Constructor

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.

New in version 3.0.

Parameters
  • parent (QWidget = None) –

  • fl (Union[Qt.WindowFlags) –

  • widgetMode

actionEvent()
addButton(self) → QPushButton

Returns the add Button

Return type

QPushButton

addButtonClicked(self)

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.

addDatabaseLayers

Emitted when a DB layer has been selected for addition [signal]

Parameters
  • paths (Iterable[str]) –

  • providerKey (str) –

addMeshLayer

Emitted when a mesh layer has been selected for addition.

New in version 3.4: [signal]

Parameters
  • url (str) –

  • baseName (str) –

  • providerKey (str) –

addRasterLayer

Emitted when a raster layer has been selected for addition [signal]

Parameters
  • rasterLayerPath (str) –

  • baseName (str) –

  • providerKey (str) –

addVectorLayer

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. [signal]

Parameters
  • uri (str) –

  • layerName (str) –

  • providerKey (str = '') –

addVectorLayers

Emitted when one or more OGR supported layers are selected for addition

Parameters
  • layerList (Iterable[str]) – list of layers protocol URIs

  • encoding (str) – encoding

  • dataSourceType (str) – string (can be “file” or “database”) [signal]

changeEvent()
childEvent()
closeEvent()
connectNotify()
connectionsChanged

Emitted when the provider’s connections have changed This signal is normally forwarded the app and used to refresh browser items [signal]

contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enableButtons

Emitted when the ok/add buttons should be enabled/disabled [signal]

Parameters

enable (bool) –

enterEvent()
event()
eventFilter()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
mapCanvas(self) → QgsMapCanvas

Returns the map canvas (can be None)

Return type

QgsMapCanvas

metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
progress

Emitted when a progress dialog is shown by the provider dialog.

Deprecated since version QGIS: 3.4 this signal is no longer used. Use QgsProxyProgressTask instead to show progress reports. [signal]

progressMessage

Emitted when a progress dialog is shown by the provider dialog [signal]

Parameters

message (str) –

receivers()
refresh(self)

Triggered when the provider’s connections need to be refreshed The default implementation does nothing

replaceVectorLayer

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 [signal]

reset(self)

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.

New in version 3.10.

resizeEvent()
sender()
senderSignalIndex()
setMapCanvas(self, mapCanvas: QgsMapCanvas)

Store a pointer to the map canvas to retrieve extent and CRS Used to select an appropriate CRS and possibly to retrieve data only in the current extent

Parameters

mapCanvas (QgsMapCanvas) –

setupButtons(self, buttonBox: QDialogButtonBox)

Connect the ok and apply/add buttons to the slots

Parameters

buttonBox (QDialogButtonBox) –

sharedPainter()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()
widgetMode(self) → QgsProviderRegistry.WidgetMode

Returns the widget mode

Return type

QgsProviderRegistry.WidgetMode