Class: QgsColorRampLegendNode

class qgis.core.QgsColorRampLegendNode(nodeLayer: QgsLayerTreeLayer, ramp: QgsColorRamp, minimumLabel: str, maximumLabel: str, parent: QObject = None)

Bases: QgsLayerTreeModelLegendNode

Constructor for QgsColorRampLegendNode.

Parameters
  • nodeLayer (QgsLayerTreeLayer) – layer node

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

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

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

  • parent (QObject = None) – 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
  • nodeLayer – layer node

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

  • settings – node settings

  • minimumValue – value associated with minimum of ramp

  • maximumValue – value associated with maximum of ramp

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

A legend node which renders a color ramp.

Methods

childEvent

connectNotify

createTemporaryRenderContext

Returns a temporary context or None if legendMapViewData are not valid

customEvent

data

param role

disconnectNotify

drawSymbol

param settings

drawSymbolText

param settings

iconSize

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

isSignalConnected

ramp

Returns the color ramp used by the node.

receivers

sender

senderSignalIndex

setIconSize

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

setSettings

Sets the node’s settings.

settings

Returns the node’s settings.

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

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)