16#ifndef QGSCOLORRAMPLEGENDNODE_H
17#define QGSCOLORRAMPLEGENDNODE_H
51 const QString &minimumLabel,
52 const QString &maximumLabel,
54 const QString &key = QString(),
55 const QString &parentKey = QString()
76 const QString &key = QString(),
77 const QString &parentKey = QString()
81 QVariant
data(
int role )
const override;
139 double minimum()
const {
return mMinimumValue; };
146 double maximum()
const {
return mMaximumValue; };
151 QString labelForMinimum()
const;
152 QString labelForMaximum()
const;
154 std::unique_ptr< QgsColorRamp > mRamp;
156 mutable QPixmap mPixmap;
160 double mMinimumValue = 0;
161 double mMaximumValue = 0;
Settings for a color ramp legend node.
const QgsColorRamp * ramp() const
Returns the color ramp used by the node.
QSize iconSize() const
Returns the icon size, which is how large the ramp will render in a layer tree widget.
QgsColorRampLegendNode(QgsLayerTreeLayer *nodeLayer, QgsColorRamp *ramp, const QString &minimumLabel, const QString &maximumLabel, QObject *parent=nullptr, const QString &key=QString(), const QString &parentKey=QString())
Constructor for QgsColorRampLegendNode.
double maximum() const
Returns the node's maximum value.
double minimum() const
Returns the node's minimum value.
QgsColorRampLegendNodeSettings settings() const
Returns the node's settings.
void setIconSize(QSize size)
Set the icon size, which controls how large the ramp will render in a layer tree widget.
void setMinimum(double minimum)
Sets the node's minimum value.
void setMaximum(double maximum)
Sets the node's maximum value.
Abstract base class for color ramps.
Layer tree node points to a map layer.
virtual QVariant data(int role) const =0
Returns data associated with the item. Must be implemented in derived class.
QgsLayerTreeModelLegendNode(QgsLayerTreeLayer *nodeL, QObject *parent=nullptr)
Construct the node with pointer to its parent layer node.
virtual QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const
Adds a symbol in base64 string within a JSON object with the key "icon".
virtual void invalidateDisplayData()
Invalidates cached display data for the node.
virtual QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const
Draws symbol on the left side of the item.
virtual QSizeF drawSymbolText(const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const
Draws label on the right side of the item.
Stores the appearance and layout settings for legend drawing with QgsLegendRenderer.
Contains information about the context of a rendering operation.