Class: QgsRasterSymbolLegendNode

Implementation of legend node interface for displaying raster legend entries.

Class Hierarchy

Inheritance diagram of qgis.core.QgsRasterSymbolLegendNode

Base classes

QgsLayerTreeModelLegendNode

An abstract interface for legend items returned from QgsMapLayerLegend implementation.

QObject

Methods

isCheckable

Returns whether the item is user-checkable - whether renderer supports enabling/disabling it.

ruleKey

Returns the unique identifier of node for identification of the item within renderer.

class qgis.core.QgsRasterSymbolLegendNode[source]

Bases: QgsLayerTreeModelLegendNode

__init__(nodeLayer: QgsLayerTreeLayer | None, color: QColor | Qt.GlobalColor, label: str | None, parent: QObject | None = None, isCheckable: bool = False, ruleKey: str | None = '', parentRuleKey: str | None = '')

Constructor for QgsRasterSymbolLegendNode.

Parameters:
  • nodeLayer (Optional[QgsLayerTreeLayer]) – layer node

  • color (Union[QColor, Qt.GlobalColor]) – color

  • label (Optional[str]) – label

  • parent (Optional[QObject] = None) – attach a parent QObject to the legend node.

  • isCheckable (bool = False) – set to True to enable the checkbox for the node (since QGIS 3.18)

  • ruleKey (Optional[str] = '') – optional identifier to allow a unique ID to be assigned to the node by a renderer (since QGIS 3.18)

  • parentRuleKey (Optional[str] = '') – rule key of parent (since QGIS 3.40)

isCheckable(self) bool[source]

Returns whether the item is user-checkable - whether renderer supports enabling/disabling it.

Added in version 3.18.

Return type:

bool

ruleKey(self) str[source]

Returns the unique identifier of node for identification of the item within renderer.

Added in version 3.18.

Return type:

str