Class: QgsColorRampLegendNode

class qgis.core.QgsColorRampLegendNode

Bases: QgsLayerTreeModelLegendNode

A legend node which renders a color ramp.

New in version 3.18.

QgsColorRampLegendNode(nodeLayer: QgsLayerTreeLayer, ramp: QgsColorRamp, minimumLabel: str, maximumLabel: str, parent: QObject = None) Constructor for QgsColorRampLegendNode.

Parameters
  • nodeLayer – layer node

  • ramp – color ramp to render in node. Ownership is transferred to the node.

  • minimumLabel – label text to render for the minimum value in the ramp

  • maximumLabel – label text to render for the maximum value in the ramp

  • parent – attach a parent QObject to the legend node.

QgsColorRampLegendNode(nodeLayer: QgsLayerTreeLayer, ramp: QgsColorRamp, settings: QgsColorRampLegendNodeSettings, minimumValue: float, maximumValue: float, parent: QObject = None) Constructor for QgsColorRampLegendNode.

Parameters
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

drawSymbolText(self, settings: QgsLegendSettings, ctx: QgsLayerTreeModelLegendNode.ItemContext, symbolSize: QSizeF)QSizeF
Parameters
Return type

QSizeF

iconSize(self)QSize

Returns the icon size, which is how large the ramp will render in a layer tree widget.

See also

setIconSize()

Return type

QSize

isSignalConnected(self, QMetaMethod)bool
ramp(self)QgsColorRamp

Returns the color ramp used by the node.

Return type

QgsColorRamp

receivers(self, PYQT_SIGNAL)int
sender(self)QObject
senderSignalIndex(self)int
setIconSize(self, size: QSize)

Set the icon size, which controls how large the ramp will render in a layer tree widget.

See also

iconSize()

Parameters

size (QSize) –

setSettings(self, settings: QgsColorRampLegendNodeSettings)

Sets the node’s settings.

See also

settings()

Parameters

settings (QgsColorRampLegendNodeSettings) –

settings(self)QgsColorRampLegendNodeSettings

Returns the node’s settings.

See also

setSettings()

Return type

QgsColorRampLegendNodeSettings

timerEvent(self, QTimerEvent)