Class: QgsSymbolWidgetContext

class qgis.gui.QgsSymbolWidgetContext

Bases: sip.wrapper

Constructor for QgsSymbolWidgetContext.

QgsSymbolWidgetContext(other: QgsSymbolWidgetContext) Copy constructor.

Parameters

other – source QgsSymbolWidgetContext

Contains settings which reflect the context in which a symbol (or renderer) widget is shown, e.g., the map canvas and relevant expression contexts.

Methods

additionalExpressionContextScopes

Returns the list of additional expression context scopes to show as available within the layer.

expressionContext

Returns the expression context used for the widget, if set.

globalProjectAtlasMapLayerScopes

Returns list of scopes: global, project, atlas, map, layer.

mapCanvas

Returns the map canvas associated with the widget.

setAdditionalExpressionContextScopes

Sets a list of additional expression context scopes to show as available within the layer.

setExpressionContext

Sets the optional expression context used for the widget.

setMapCanvas

Sets the map canvas associated with the widget.

additionalExpressionContextScopes(self) → List[QgsExpressionContextScope]

Returns the list of additional expression context scopes to show as available within the layer.

Return type

List[QgsExpressionContextScope]

expressionContext(self) → QgsExpressionContext

Returns the expression context used for the widget, if set. This expression context is used for evaluating data defined symbol properties and for populating based expression widgets in the layer widget.

Return type

QgsExpressionContext

globalProjectAtlasMapLayerScopes(self, layer: QgsMapLayer) → List[QgsExpressionContextScope]

Returns list of scopes: global, project, atlas, map, layer. Ownership is transferred to the caller.

New in version 3.0.

Parameters

layer (QgsMapLayer) –

Return type

List[QgsExpressionContextScope]

mapCanvas(self) → QgsMapCanvas

Returns the map canvas associated with the widget.

See also

setMapCanvas()

Return type

QgsMapCanvas

setAdditionalExpressionContextScopes(self, scopes: object)

Sets a list of additional expression context scopes to show as available within the layer.

Parameters

scopes (object) – list of additional scopes which will be added in order to the end of the default expression context

setExpressionContext(self, context: QgsExpressionContext)

Sets the optional expression context used for the widget. This expression context is used for evaluating data defined symbol properties and for populating based expression widgets in the layer widget.

Parameters

context (QgsExpressionContext) – expression context pointer. Ownership is not transferred.

setMapCanvas(self, canvas: QgsMapCanvas)

Sets the map canvas associated with the widget. This allows the widget to retrieve the current map scale and other properties from the canvas.

Parameters

canvas (QgsMapCanvas) – map canvas

See also

mapCanvas()