QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
Implementation of legend node interface for displaying raster legend entries. More...
#include <qgslayertreemodellegendnode.h>
Public Member Functions | |
QgsRasterSymbolLegendNode (QgsLayerTreeLayer *nodeLayer, const QColor &color, const QString &label, QObject *parent=nullptr, bool isCheckable=false, const QString &ruleKey=QString()) | |
Constructor for QgsRasterSymbolLegendNode. More... | |
QVariant | data (int role) const override |
Returns data associated with the item. Must be implemented in derived class. More... | |
QSizeF | drawSymbol (const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override |
Draws symbol on the left side of the item. More... | |
QJsonObject | exportSymbolToJson (const QgsLegendSettings &settings, const QgsRenderContext &context) const override |
Adds a symbol in base64 string within a JSON object with the key "icon". More... | |
Qt::ItemFlags | flags () const override |
Returns item flags associated with the item. Default implementation returns Qt::ItemIsEnabled. More... | |
bool | isCheckable () const |
Returns whether the item is user-checkable - whether renderer supports enabling/disabling it. More... | |
QString | ruleKey () const |
Returns the unique identifier of node for identification of the item within renderer. More... | |
bool | setData (const QVariant &value, int role) override |
Sets some data associated with the item. Default implementation does nothing and returns false . More... | |
Public Member Functions inherited from QgsLayerTreeModelLegendNode | |
virtual bool | columnBreak () const |
Returns whether a forced column break should occur before the node. More... | |
virtual ItemMetrics | draw (const QgsLegendSettings &settings, ItemContext *ctx) |
Entry point called from QgsLegendRenderer to do the rendering. More... | |
virtual QSizeF | drawSymbolText (const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const |
Draws label on the right side of the item. More... | |
QJsonObject | exportToJson (const QgsLegendSettings &settings, const QgsRenderContext &context) |
Entry point called from QgsLegendRenderer to do the rendering in a JSON object. More... | |
virtual void | invalidateMapBasedData () |
Notification from model that information from associated map view has changed. More... | |
virtual bool | isEmbeddedInParent () const |
virtual bool | isScaleOK (double scale) const |
QgsLayerTreeLayer * | layerNode () const |
Returns pointer to the parent layer node. More... | |
QgsLayerTreeModel * | model () const |
Returns pointer to model owning this legend node. More... | |
virtual void | setColumnBreak (bool breakBeforeNode) |
Sets whether a forced column break should occur before the node. More... | |
virtual void | setEmbeddedInParent (bool embedded) |
virtual void | setUserLabel (const QString &userLabel) |
virtual void | setUserPatchSize (QSizeF size) |
Sets the user (overridden) size for the legend node. More... | |
virtual QString | userLabel () const |
virtual QSizeF | userPatchSize () const |
Returns the user (overridden) size for the legend node. More... | |
Additional Inherited Members | |
Public Types inherited from QgsLayerTreeModelLegendNode | |
enum | LegendNodeRoles { RuleKeyRole = Qt::UserRole , ParentRuleKeyRole , NodeTypeRole } |
Legend node data roles. More... | |
enum | NodeTypes { SimpleLegend , SymbolLegend , RasterSymbolLegend , ImageLegend , WmsLegend , DataDefinedSizeLegend , EmbeddedWidget , ColorRampLegend } |
Types of legend nodes. More... | |
Public Slots inherited from QgsLayerTreeModelLegendNode | |
void | checkAllItems () |
Checks all checkable items belonging to the same layer as this node. More... | |
void | toggleAllItems () |
Toggle all checkable items belonging to the same layer as this node. More... | |
void | uncheckAllItems () |
Unchecks all checkable items belonging to the same layer as this node. More... | |
Signals inherited from QgsLayerTreeModelLegendNode | |
void | dataChanged () |
Emitted on internal data change so the layer tree model can forward the signal to views. More... | |
void | sizeChanged () |
Emitted when the size of this node changes. More... | |
Protected Member Functions inherited from QgsLayerTreeModelLegendNode | |
QgsLayerTreeModelLegendNode (QgsLayerTreeLayer *nodeL, QObject *parent=nullptr) | |
Construct the node with pointer to its parent layer node. More... | |
QgsRenderContext * | createTemporaryRenderContext () const |
Returns a temporary context or nullptr if legendMapViewData are not valid. More... | |
Protected Attributes inherited from QgsLayerTreeModelLegendNode | |
bool | mColumnBreakBeforeNode = false |
bool | mEmbeddedInParent |
QgsLayerTreeLayer * | mLayerNode = nullptr |
QgsLegendPatchShape | mPatchShape |
QString | mUserLabel |
QSizeF | mUserSize |
Implementation of legend node interface for displaying raster legend entries.
Definition at line 606 of file qgslayertreemodellegendnode.h.
QgsRasterSymbolLegendNode::QgsRasterSymbolLegendNode | ( | QgsLayerTreeLayer * | nodeLayer, |
const QColor & | color, | ||
const QString & | label, | ||
QObject * | parent = nullptr , |
||
bool | isCheckable = false , |
||
const QString & | ruleKey = QString() |
||
) |
Constructor for QgsRasterSymbolLegendNode.
nodeLayer | layer node |
color | color |
label | label |
parent | attach a parent QObject to the legend node. |
isCheckable | set to true to enable the checkbox for the node (since QGIS 3.18) |
ruleKey | optional identifier to allow a unique ID to be assigned to the node by a renderer (since QGIS 3.18) |
Definition at line 982 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Returns data associated with the item. Must be implemented in derived class.
Implements QgsLayerTreeModelLegendNode.
Definition at line 999 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Draws symbol on the left side of the item.
settings | Legend layout configuration |
ctx | Context for rendering - may be nullptr if only doing layout without actual rendering |
itemHeight | Minimal height of the legend item - used for correct positioning when rendering |
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 1070 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Adds a symbol in base64 string within a JSON object with the key "icon".
settings | Legend layout configuration |
context | Rendering context |
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 1128 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Returns item flags associated with the item. Default implementation returns Qt::ItemIsEnabled.
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 991 of file qgslayertreemodellegendnode.cpp.
|
inline |
Returns whether the item is user-checkable - whether renderer supports enabling/disabling it.
Definition at line 641 of file qgslayertreemodellegendnode.h.
|
inline |
Returns the unique identifier of node for identification of the item within renderer.
Definition at line 634 of file qgslayertreemodellegendnode.h.
|
overridevirtual |
Sets some data associated with the item. Default implementation does nothing and returns false
.
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 1042 of file qgslayertreemodellegendnode.cpp.