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(self, QActionEvent)
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(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
connectionsChanged

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

contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enableButtons

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

Parameters

enable (bool) –

enterEvent(self, QEvent)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) → bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) → bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
mapCanvas(self)QgsMapCanvas

Returns the map canvas (can be None)

Return type

QgsMapCanvas

metric(self, QPaintDevice.PaintDeviceMetric) → int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
paintEvent(self, QPaintEvent)
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(self, PYQT_SIGNAL) → int
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(self, QResizeEvent)
sender(self) → QObject
senderSignalIndex(self) → int
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(self) → QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)
widgetMode(self) → QgsProviderRegistry.WidgetMode

Returns the widget mode

Return type

QgsProviderRegistry.WidgetMode