Class: QgsRendererWidget

Base class for renderer settings widgets.

WORKFLOW:

  • open renderer dialog with some RENDERER (never null!)

  • find out which widget to use

  • instantiate it and set in stacked widget

  • on any change of renderer type, create some default (dummy?) version and change the stacked widget

  • when clicked OK/Apply, get the renderer from active widget and clone it for the layer

Class Hierarchy

Inheritance diagram of qgis.gui.QgsRendererWidget

Base classes

QgsPanelWidget

Base class for any widget that can be shown as a inline panel

QWidget

QObject

QPaintDevice

QgsExpressionContextGenerator

Abstract interface for generating an expression context.

Subclasses

Qgs25DRendererWidget

param layer:

the layer where this renderer is applied :param style: :param renderer: the mask renderer (will not take ownership)

QgsCategorizedSymbolRendererWidget

QgsEmbeddedSymbolRendererWidget

A widget used represent options of a QgsEmbeddedSymbolRenderer

QgsGraduatedSymbolRendererWidget

QgsHeatmapRendererWidget

param layer:

the layer where this renderer is applied :param style: :param renderer: the mask renderer (will not take ownership)

QgsInvertedPolygonRendererWidget

A widget used represent options of a QgsInvertedPolygonRenderer

QgsMergedFeatureRendererWidget

A widget used represent options of a QgsMergedFeatureRenderer

QgsNullSymbolRendererWidget

Blank widget for customizing QgsNullSymbolRenderer.

QgsPointClusterRendererWidget

A widget which allows configuration of the properties for a QgsPointClusterRenderer.

QgsPointDisplacementRendererWidget

QgsRuleBasedRendererWidget

QgsSingleSymbolRendererWidget

class qgis.gui.QgsRendererWidget[source]

Bases: QgsPanelWidget, QgsExpressionContextGenerator

apply()[source]
applyChanges(self)[source]

This method should be called whenever the renderer is actually set on the layer.

changeSymbolAngle(self)[source]

Change marker angles of selected symbols

changeSymbolColor(self)[source]

Change color of selected symbols

changeSymbolOpacity(self)[source]

Change opacity of selected symbols

changeSymbolSize(self)[source]

Change marker sizes of selected symbols

changeSymbolUnit(self)[source]

Change units mm/map units of selected symbols

changeSymbolWidth(self)[source]

Change line widths of selected symbols

context(self) QgsSymbolWidgetContext[source]

Returns the context in which the renderer widget is shown, e.g., the associated map canvas and expression contexts.

See also

setContext()

Return type:

QgsSymbolWidgetContext

contextMenuViewCategories(self, p: QPoint)[source]
Parameters:

p (QPoint)

copy(self)[source]
createDataDefinedSizeLegendWidget(self, symbol: QgsMarkerSymbol | None, ddsLegend: QgsDataDefinedSizeLegend | None) QgsDataDefinedSizeLegendWidget | None[source]

Creates widget to setup data-defined size legend. Returns newly created panel - may be None if it could not be opened. Ownership is transferred to the caller.

Parameters:
Return type:

Optional[QgsDataDefinedSizeLegendWidget]

signal layerVariablesChanged[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.

paste(self)[source]
pasteSymbolToSelection(self)[source]

Pastes the clipboard symbol over selected items.

Added in version 3.10.

refreshSymbolView(self)[source]
registerDataDefinedButton(self, button: QgsPropertyOverrideButton | None, key: QgsFeatureRenderer.Property)[source]

Registers a data defined override button. Handles setting up connections for the button and initializing the button to show the correct descriptions and help text for the associated property.

Parameters:
renderer(self) QgsFeatureRenderer | None[source]

Returns pointer to the renderer (no transfer of ownership)

Return type:

Optional[QgsFeatureRenderer]

selectedSymbols(self) List[QgsSymbol]

Subclasses may provide the capability of changing multiple symbols at once by implementing the following two methods and by connecting the slot contextMenuViewCategories(const QPoint&).

Return type:

List[QgsSymbol]

setContext(self, context: QgsSymbolWidgetContext)[source]

Sets the context in which the renderer widget is shown, e.g., the associated map canvas and expression contexts.

Parameters:

context (QgsSymbolWidgetContext) – symbol widget context

See also

context()

setSymbolLevels(self, levels: Iterable[QgsLegendSymbolItem], enabled: bool)[source]

Sets the symbol levels for the renderer defined in the widget.

The levels argument defines the updated list of symbols with rendering passes set.

The enabled arguments specifies if symbol levels should be enabled for the renderer.

Added in version 3.20.

Parameters:
showSymbolLevelsDialog(self, r: QgsFeatureRenderer | None)[source]

Show a dialog with renderer’s symbol level settings.

Parameters:

r (Optional[QgsFeatureRenderer])

signal symbolLevelsChanged[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.

vectorLayer(self) QgsVectorLayer | None[source]

Returns the vector layer associated with the widget.

Return type:

Optional[QgsVectorLayer]