Class: QgsColorRampLegendNode¶
A legend node which renders a color ramp.
Added in version 3.18.
Class Hierarchy¶
Base classes¶
An abstract interface for legend items returned from |
|
Methods
Returns the icon size, which is how large the ramp will render in a layer tree widget. |
|
Returns the color ramp used by the node. |
|
Set the icon size, which controls how large the ramp will render in a layer tree widget. |
|
Sets the node's settings. |
|
Returns the node's settings. |
- class qgis.core.QgsColorRampLegendNode[source]¶
Bases:
QgsLayerTreeModelLegendNode
- __init__(nodeLayer: QgsLayerTreeLayer | None, ramp: QgsColorRamp | None, minimumLabel: str | None, maximumLabel: str | None, parent: QObject | None = None, key: str | None = '', parentKey: str | None = '')
Constructor for QgsColorRampLegendNode.
- Parameters:
nodeLayer (Optional[QgsLayerTreeLayer]) – layer node
ramp (Optional[QgsColorRamp]) – color ramp to render in node. Ownership is transferred to the node.
minimumLabel (Optional[str]) – label text to render for the minimum value in the ramp
maximumLabel (Optional[str]) – label text to render for the maximum value in the ramp
parent (Optional[QObject] = None) – attach a parent QObject to the legend node.
key (Optional[str] = '') – rule key. optional identifier to allow a unique ID to be assigned to the node by a renderer (since QGIS 3.40)
parentKey (Optional[str] = '') – rule key of parent (since QGIS 3.40)
- __init__(nodeLayer: QgsLayerTreeLayer | None, ramp: QgsColorRamp | None, settings: QgsColorRampLegendNodeSettings, minimumValue: float, maximumValue: float, parent: QObject | None = None, key: str | None = '', parentKey: str | None = '')
Constructor for QgsColorRampLegendNode.
- Parameters:
nodeLayer (Optional[QgsLayerTreeLayer]) – layer node
ramp (Optional[QgsColorRamp]) – color ramp to render in node. Ownership is transferred to the node.
settings (QgsColorRampLegendNodeSettings) – node settings
minimumValue (float) – value associated with minimum of ramp
maximumValue (float) – value associated with maximum of ramp
parent (Optional[QObject] = None) – attach a parent QObject to the legend node.
key (Optional[str] = '') – rule key. optional identifier to allow a unique ID to be assigned to the node by a renderer (since QGIS 3.40)
parentKey (Optional[str] = '') – rule key of parent (since QGIS 3.40)
- iconSize(self) QSize [source]¶
Returns the icon size, which is how large the ramp will render in a layer tree widget.
See also
- Return type:
QSize
- ramp(self) QgsColorRamp | None [source]¶
Returns the color ramp used by the node.
- Return type:
Optional[QgsColorRamp]
- setIconSize(self, size: QSize)[source]¶
Set the icon
size
, which controls how large the ramp will render in a layer tree widget.See also
- Parameters:
size (QSize)
- setSettings(self, settings: QgsColorRampLegendNodeSettings)[source]¶
Sets the node’s
settings
.See also
- Parameters:
settings (QgsColorRampLegendNodeSettings)
- settings(self) QgsColorRampLegendNodeSettings [source]¶
Returns the node’s settings.
See also
- Return type: