Class: QgsExpressionBuilderDialog

A generic dialog for building expression strings

Class Hierarchy

Inheritance diagram of qgis.gui.QgsExpressionBuilderDialog

Base classes

QDialog

QWidget

QObject

QPaintDevice

Methods

allowEvalErrors

Allow accepting invalid expressions.

done

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

expectedOutputFormat

Returns the expected format string, which is shown in the dialog.

expressionBuilder

The builder widget that is used by the dialog

expressionContext

Returns the expression context for the dialog.

expressionText

setAllowEvalErrors

Allow accepting expressions with evaluation errors.

setExpectedOutputFormat

Set the expected format string, which is shown in the dialog.

setExpressionContext

Sets the expression context for the dialog.

setExpressionText

setGeomCalculator

Sets geometry calculator used in distance/area calculations.

Signals

allowEvalErrorsChanged

Allow accepting expressions with evaluation errors.

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]

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.

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)