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.

New in version 3.0: Enums

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.

Signals

Attributes

additionalExpressionContextScopes(self) → List[QgsExpressionContextScope]

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

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.

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.

mapCanvas(self) → QgsMapCanvas

Returns the map canvas associated with the widget.

See also

setMapCanvas()

setAdditionalExpressionContextScopes(self, scopes: object)

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

Parameters

scopes – 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 – 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 – map canvas

See also

mapCanvas()