Class: QgsDataSourceSelectWidget¶
- class qgis.gui.QgsDataSourceSelectWidget¶
Bases:
QgsPanelWidget
The
QgsDataSourceSelectWidget
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.New in version 3.14.
QgsDataSourceSelectWidget(browserModel:
QgsBrowserGuiModel
= None, setFilterByLayerType: bool = False, layerType:QgsMapLayerType
= QgsMapLayerType.VectorLayer, parent: QWidget = None) Constructs aQgsDataSourceSelectWidget
, optionally filtering by layer type- Parameters:
browserModel – an existing browser model (typically from app), if
None
an instance will be createdsetFilterByLayerType – 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
Methods
Expands out a file
path
in the view.Overridden key press event to handle the esc event on the widget.
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 filteringScroll to last selected index and expand it's children
Show/hide filter widget
Returns the (possibly invalid) uri of the selected data source
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- actionEvent(self, QActionEvent)¶
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- closeEvent(self, QCloseEvent)¶
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QContextMenuEvent)¶
- create(self, window: PyQt5.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 ¶
- expandPath(self, path: str)¶
Expands out a file
path
in the view.The
path
must correspond to a valid directory existing on the file system.New in version 3.28.
- Parameters:
path (str) –
- 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 ¶
- itemTriggered¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- keyPressEvent(self, event: QKeyEvent)¶
Overridden key press event to handle the esc event on the widget.
- Parameters:
event – The key event
- 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], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, QPaintEvent)¶
- receivers(self, PYQT_SIGNAL) int ¶
- resizeEvent(self, QResizeEvent)¶
- selectionChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setCaseSensitive(self, caseSensitive: bool)¶
Sets filter case sensitivity
- Parameters:
caseSensitive (bool) –
- setDescription(self, description: str)¶
Sets a description label
- Parameters:
description (str) – a description string
Note
the description will be displayed at the bottom of the dialog
New in version 3.8.
- setFilter(self)¶
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- Parameters:
layerType (QgsMapLayerType) –
- showEvent(self, e: QShowEvent)¶
Scroll to last selected index and expand it’s children
- Parameters:
e (QShowEvent) –
- showFilterWidget(self, visible: bool)¶
Show/hide filter widget
- Parameters:
visible (bool) –
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- uri(self) QgsMimeDataUtils.Uri ¶
Returns the (possibly invalid) uri of the selected data source
- Return type:
- validationChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- wheelEvent(self, QWheelEvent)¶