Class: QgsExpressionSelectionDialog

class qgis.gui.QgsExpressionSelectionDialog

Bases: PyQt5.QtWidgets.QDialog

This class offers a dialog to change feature selections. To do so, a QgsExpressionBuilderWidget is shown in a dialog. It offers the possibilities to create a new selection, add to the current selection remove from the current selection or select within the current selection.

QgsExpressionSelectionDialog(layer: Optional[QgsVectorLayer], startText: Optional[str] = ‘’, parent: Optional[QWidget] = None) Creates a new selection dialog.

actionEvent(self, a0: QActionEvent | None)
changeEvent(self, a0: QEvent | None)
childEvent(self, a0: QChildEvent | None)
closeEvent(self, closeEvent: QCloseEvent | None)

Implementation for closeEvent Saves the window geometry


closeEvent (Optional[QCloseEvent]) – Event object. Unused.

connectNotify(self, signal: QMetaMethod)
contextMenuEvent(self, a0: QContextMenuEvent | None)
create(self, window: PyQt5.sip.voidptr = None, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, a0: QEvent | None)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, signal: QMetaMethod)
done(self, r: int)

Implementation for done (default behavior when pressing esc) Calls close, so the window geometry gets saved and the object deleted.


r (int) – Result value. Unused.

dragEnterEvent(self, a0: QDragEnterEvent | None)
dragLeaveEvent(self, a0: QDragLeaveEvent | None)
dragMoveEvent(self, a0: QDragMoveEvent | None)
dropEvent(self, a0: QDropEvent | None)
enterEvent(self, a0: QEvent | None)
event(self, a0: QEvent | None) bool
eventFilter(self, a0: QObject | None, a1: QEvent | None) bool
expressionBuilder(self) QgsExpressionBuilderWidget | None

The builder widget that is used by the dialog

Return type:



The builder widget that is used by the dialog

expressionText(self) str

Returns the current expression text

Return type:



The expression text

focusInEvent(self, a0: QFocusEvent | None)
focusNextChild(self) bool
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, a0: QFocusEvent | None)
focusPreviousChild(self) bool
hideEvent(self, a0: QHideEvent | None)
initPainter(self, painter: QPainter | None)
inputMethodEvent(self, a0: QInputMethodEvent | None)
isSignalConnected(self, signal: QMetaMethod) bool
keyPressEvent(self, a0: QKeyEvent | None)
keyReleaseEvent(self, a0: QKeyEvent | None)
leaveEvent(self, a0: QEvent | None)
metric(self, a0: QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, a0: QMouseEvent | None)
mouseMoveEvent(self, a0: QMouseEvent | None)
mousePressEvent(self, a0: QMouseEvent | None)
mouseReleaseEvent(self, a0: QMouseEvent | None)
moveEvent(self, a0: QMoveEvent | None)
nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)
paintEvent(self, a0: QPaintEvent | None)
receivers(self, signal: PYQT_SIGNAL) int
resizeEvent(self, a0: QResizeEvent | None)
sender(self) QObject | None
senderSignalIndex(self) int
setExpressionText(self, text: str | None)

Sets the current expression text


text (Optional[str]) – the expression text to set

setGeomCalculator(self, da: QgsDistanceArea)

Sets geometry calculator used in distance/area calculations.


da (QgsDistanceArea)

setMapCanvas(self, canvas: QgsMapCanvas | None)

Sets a map canvas associated with the dialog.


canvas (Optional[QgsMapCanvas])

setMessageBar(self, messageBar: QgsMessageBar | None)

Sets the message bar to display feedback from the dialog. This is used when zooming to features to display the count of selected features.


messageBar (Optional[QgsMessageBar]) – target message bar

sharedPainter(self) QPainter | None
showEvent(self, a0: QShowEvent | None)
tabletEvent(self, a0: QTabletEvent | None)
timerEvent(self, a0: QTimerEvent | None)
wheelEvent(self, a0: QWheelEvent | None)