Class: QgsDataSourceSelectDialog

class qgis.gui.QgsDataSourceSelectDialog(browserModel: QgsBrowserGuiModel = None, setFilterByLayerType: bool = False, layerType: QgsMapLayerType = QgsMapLayerType.VectorLayer, parent: QWidget = None)

Bases: PyQt5.QtWidgets.QDialog

Constructs a QgsDataSourceSelectDialog, optionally filtering by layer type

  • browserModel – an existing browser model (typically from app), if None 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

The QgsDataSourceSelectDialog class 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.

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
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)
enterEvent(self, QEvent)
event(self, QEvent)bool
eventFilter(self, QObject, QEvent)bool
focusInEvent(self, QFocusEvent)
focusNextPrevChild(self, bool)bool
focusOutEvent(self, QFocusEvent)
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod)bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
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)
receivers(self, PYQT_SIGNAL)int
resizeEvent(self, QResizeEvent)
setCaseSensitive(self, caseSensitive: bool)

Sets filter case sensitivity


caseSensitive (bool) –

setDescription(self, description: str)

Sets a description label


description (str) – a description string


the description will be displayed at the bottom of the dialog

New in version 3.8.


Apply filter to the model

setFilterSyntax(self, QAction)

Sets filter syntax

setLayerTypeFilter(self, layerType: QgsMapLayerType)

Sets layer type filter to layerType and activates the filtering


layerType (QgsMapLayerType) –

showEvent(self, QShowEvent)
showFilterWidget(self, visible: bool)

Show/hide filter widget


visible (bool) –

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)

Returns the (possibly invalid) uri of the selected data source

Return type


wheelEvent(self, QWheelEvent)