QgsRasterSymbolLegendNode class

Implementation of legend node interface for displaying raster legend entries.

Base classes

class QgsLayerTreeModelLegendNode
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegend implementation.

Constructors, destructors, conversion operators

QgsRasterSymbolLegendNode(QgsLayerTreeLayer* nodeLayer, const QColor& color, const QString& label, QObject* parent = nullptr)
Constructor for QgsRasterSymbolLegendNode.

Public functions

auto data(int role) const -> QVariant override
Returns data associated with the item. Must be implemented in derived class.
auto drawSymbol(const QgsLegendSettings& settings, ItemContext* ctx, double itemHeight) const -> QSizeF override
Draws symbol on the left side of the item.

Function documentation

QgsRasterSymbolLegendNode::QgsRasterSymbolLegendNode(QgsLayerTreeLayer* nodeLayer, const QColor& color, const QString& label, QObject* parent = nullptr)

Constructor for QgsRasterSymbolLegendNode.

Parameters
nodeLayer layer node
color color
label label
parent attach a parent QObject to the legend node.

QSizeF QgsRasterSymbolLegendNode::drawSymbol(const QgsLegendSettings& settings, ItemContext* ctx, double itemHeight) const override

Draws symbol on the left side of the item.

Parameters
settings Legend layout configuration
ctx Context for rendering - may be null if only doing layout without actual rendering
itemHeight Minimal height of the legend item - used for correct positioning when rendering
Returns Real size of the symbol (may be bigger than "normal" symbol size from settings)