Class: QgsExpressionBuilderDialog

A generic dialog for building expression strings.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsExpressionBuilderDialog

Base classes

QDialog

QWidget

QObject

QPaintDevice

class qgis.gui.QgsExpressionBuilderDialog[source]

Bases: QDialog

allowEvalErrors(self) bool[source]

Allow accepting invalid expressions. This can be useful when we are not able to provide an expression context of which we are sure it’s completely populated.

Return type:

bool

signal allowEvalErrorsChanged[source]

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.

virtual done(self, r: int)[source]

Is called when the dialog get accepted or rejected Used to save geometry

Parameters:

r (int) – result value (unused)

expectedOutputFormat(self) str[source]

Returns the expected format string, which is shown in the dialog. This is purely a text format and no expression validation is done against it.

Return type:

str

expressionBuilder(self) QgsExpressionBuilderWidget | None[source]

The builder widget that is used by the dialog

Return type:

Optional[QgsExpressionBuilderWidget]

expressionContext(self) QgsExpressionContext[source]

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

Return type:

QgsExpressionContext

expressionText(self) str[source]
Return type:

str

setAllowEvalErrors(self, allowEvalErrors: bool)[source]

Allow accepting expressions with evaluation errors. This can be useful when we are not able to provide an expression context of which we are sure it’s completely populated.

Parameters:

allowEvalErrors (bool)

setExpectedOutputFormat(self, expected: str | None)[source]

Set the expected format string, which is shown in the dialog. This is purely a text format and no expression validation is done against it.

Parameters:

expected (Optional[str])

setExpressionContext(self, context: QgsExpressionContext)[source]

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

Parameters:

context (QgsExpressionContext) – expression context

setExpressionText(self, text: str | None)[source]
Parameters:

text (Optional[str])

setGeomCalculator(self, da: QgsDistanceArea)[source]

Sets geometry calculator used in distance/area calculations.

Parameters:

da (QgsDistanceArea)