Class: QgsRasterSymbolLegendNode

class qgis.core.QgsRasterSymbolLegendNode(nodeLayer: QgsLayerTreeLayer, color: Union[QColor, Qt.GlobalColor, QGradient], label: str, parent: QObject = None, isCheckable: bool = False, ruleKey: str = '')

Bases: QgsLayerTreeModelLegendNode

Constructor for QgsRasterSymbolLegendNode.

Parameters
  • nodeLayer (QgsLayerTreeLayer) – layer node

  • color (Union[QColor) – color

  • label (str) – label

  • parent (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 (str = '') – optional identifier to allow a unique ID to be assigned to the node by a renderer (since QGIS 3.18)

Implementation of legend node interface for displaying raster legend entries

Methods

childEvent

connectNotify

createTemporaryRenderContext

Returns a temporary context or None if legendMapViewData are not valid

customEvent

data

param role

disconnectNotify

drawSymbol

param settings

exportSymbolToJson

param settings

flags

rtype

Qt.ItemFlags

isCheckable

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

isSignalConnected

receivers

ruleKey

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

sender

senderSignalIndex

setData

param value

timerEvent

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createTemporaryRenderContext(self)QgsRenderContext

Returns a temporary context or None if legendMapViewData are not valid

customEvent(self, QEvent)
data(self, role: int) → Any
Parameters

role (int) –

Return type

Any

disconnectNotify(self, QMetaMethod)
drawSymbol(self, settings: QgsLegendSettings, ctx: QgsLayerTreeModelLegendNode.ItemContext, itemHeight: float) → QSizeF
Parameters
Return type

QSizeF

exportSymbolToJson(self, settings: QgsLegendSettings, context: QgsRenderContext) → Dict[str, QJsonValue]
Parameters
Return type

Dict[str, QJsonValue]

flags(self) → Qt.ItemFlags
Return type

Qt.ItemFlags

isCheckable(self) → bool

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

New in version 3.18.

Return type

bool

isSignalConnected(self, QMetaMethod) → bool
receivers(self, PYQT_SIGNAL) → int
ruleKey(self) → str

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

New in version 3.18.

Return type

str

sender(self) → QObject
senderSignalIndex(self) → int
setData(self, value: Any, role: int) → bool
Parameters
  • value (Any) –

  • role (int) –

Return type

bool

timerEvent(self, QTimerEvent)