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: 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.
messageBar Returns the message bar 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.
setMessageBar Sets the message bar 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()

messageBar(self) → QgsMessageBar

Returns the message bar associated with the widget.

See also

setMessageBar()

New in version 3.6.

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()

setMessageBar(self, bar: QgsMessageBar)

Sets the message bar associated with the widget. This allows the widget to push feedback messages to the appropriate message bar.

See also

messageBar()

New in version 3.6.