QgsImageLegendNode class

Implementation of legend node interface for displaying arbitrary raster image.

Base classes

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

Constructors, destructors, conversion operators

QgsImageLegendNode(QgsLayerTreeLayer* nodeLayer, const QImage& img, QObject* parent = nullptr)
Constructor for QgsImageLegendNode.

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

QgsImageLegendNode::QgsImageLegendNode(QgsLayerTreeLayer* nodeLayer, const QImage& img, QObject* parent = nullptr)

Constructor for QgsImageLegendNode.

Parameters
nodeLayer layer node
img the image
parent attach a parent QObject to the legend node.

QSizeF QgsImageLegendNode::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)