Class: QgsExpressionPreviewWidget

class qgis.gui.QgsExpressionPreviewWidget

Bases: PyQt5.QtWidgets.QWidget

QgsExpressionPreviewWidget is a widget to preview an expression result. If the layer is set, one can browse across features to see the different outputs.

New in version 3.14.

QgsExpressionPreviewWidget(parent: QWidget = None) Constructor

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

evalError

Will be set to True if the current expression text reported an eval error with the context.

event

expressionContext

Returns the expression context for the widget.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

parserError

Will be set to True if the current expression text reports a parser error with the context.

parserErrors

Returns the expression parser erros

receivers

resizeEvent

rootNode

Returns the root node of the expression

sender

senderSignalIndex

setCurrentFeature

sets the current feature used

setExpressionContext

Sets the expression context for the widget.

setExpressionText

Sets the expression

setGeomCalculator

Sets geometry calculator used in distance/area calculations.

setLayer

Sets the layer used in the preview

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

evalErrorChanged

Will be set to True if the current expression text reported an eval error with the context.

expressionParsed

Emitted when the user changes the expression in the widget.

parserErrorChanged

Will be set to True if the current expression text reported a parser error with the context.

toolTipChanged

Emitted whenever the tool tip changed [signal]

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)
evalError(self)bool

Will be set to True if the current expression text reported an eval error with the context.

Return type

bool

evalErrorChanged

Will be set to True if the current expression text reported an eval error with the context. [signal]

event(self, QEvent)bool
expressionContext(self)QgsExpressionContext

Returns the expression context for the widget. The context is used for the expression preview result and for populating the list of available functions and variables.

Return type

QgsExpressionContext

expressionParsed

Emitted when the user changes the expression in the widget. Users of this widget should connect to this signal to decide if to let the user continue.

Parameters

isValid (bool) – Is True if the expression the user has typed is valid. [signal]

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)
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)
parserError(self)bool

Will be set to True if the current expression text reports a parser error with the context.

Return type

bool

parserErrorChanged

Will be set to True if the current expression text reported a parser error with the context. [signal]

parserErrors(self)List[QgsExpression.ParserError]

Returns the expression parser erros

Return type

List[QgsExpression.ParserError]

receivers(self, PYQT_SIGNAL)int
resizeEvent(self, QResizeEvent)
rootNode(self)QgsExpressionNode

Returns the root node of the expression

Return type

QgsExpressionNode

sender(self)QObject
senderSignalIndex(self)int
setCurrentFeature(self, feature: QgsFeature)

sets the current feature used

Parameters

feature (QgsFeature) –

setExpressionContext(self, context: QgsExpressionContext)

Sets the expression context for the widget. The context is used for the expression preview result and to populate the list of available functions and variables.

Parameters

context (QgsExpressionContext) – expression context

setExpressionText(self, expression: str)

Sets the expression

Parameters

expression (str) –

setGeomCalculator(self, da: QgsDistanceArea)

Sets geometry calculator used in distance/area calculations.

Parameters

da (QgsDistanceArea) –

setLayer(self, layer: QgsVectorLayer)

Sets the layer used in the preview

Parameters

layer (QgsVectorLayer) –

sharedPainter(self)QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
toolTipChanged

Emitted whenever the tool tip changed [signal]

Parameters

toolTip (str) –

updateMicroFocus(self)
wheelEvent(self, QWheelEvent)