QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Implementation of legend node interface for displaying WMS legend entries. More...
#include <qgslayertreemodellegendnode.h>
Public Member Functions | |
QgsWmsLegendNode (QgsLayerTreeLayer *nodeLayer, QObject *parent=nullptr) | |
Constructor for QgsWmsLegendNode. | |
~QgsWmsLegendNode () override | |
QVariant | data (int role) const override |
Returns data associated with the item. Must be implemented in derived class. | |
QSizeF | drawSymbol (const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override |
Draws symbol on the left side of the item. | |
QJsonObject | exportSymbolToJson (const QgsLegendSettings &settings, const QgsRenderContext &context) const override |
Adds a symbol in base64 string within a JSON object with the key "icon". | |
QImage | getLegendGraphicBlocking () const |
Fetches the image from the server and returns it. | |
void | invalidateMapBasedData () override |
Notification from model that information from associated map view has changed. | |
Public Member Functions inherited from QgsLayerTreeModelLegendNode | |
virtual bool | columnBreak () const |
Returns whether a forced column break should occur before the node. | |
virtual ItemMetrics | draw (const QgsLegendSettings &settings, ItemContext *ctx) |
Entry point called from QgsLegendRenderer to do the rendering. | |
virtual QSizeF | drawSymbolText (const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const |
Draws label on the right side of the item. | |
QJsonObject | exportToJson (const QgsLegendSettings &settings, const QgsRenderContext &context) |
Entry point called from QgsLegendRenderer to do the rendering in a JSON object. | |
virtual Qt::ItemFlags | flags () const |
Returns item flags associated with the item. Default implementation returns Qt::ItemIsEnabled. | |
virtual bool | isEmbeddedInParent () const |
virtual bool | isScaleOK (double scale) const |
QgsLayerTreeLayer * | layerNode () const |
Returns pointer to the parent layer node. | |
QgsLayerTreeModel * | model () const |
Returns pointer to model owning this legend node. | |
virtual void | setColumnBreak (bool breakBeforeNode) |
Sets whether a forced column break should occur before the node. | |
virtual bool | setData (const QVariant &value, int role) |
Sets some data associated with the item. Default implementation does nothing and returns false . | |
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. | |
virtual QString | userLabel () const |
virtual QSizeF | userPatchSize () const |
Returns the user (overridden) size for the legend node. | |
Additional Inherited Members | |
Public Types inherited from QgsLayerTreeModelLegendNode | |
enum class | CustomRole : int { RuleKey = Qt::UserRole , ParentRuleKey , NodeType , IsDataDefinedSize } |
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. | |
void | toggleAllItems () |
Toggle all checkable items belonging to the same layer as this node. | |
void | uncheckAllItems () |
Unchecks all checkable items belonging to the same layer as this node. | |
Signals inherited from QgsLayerTreeModelLegendNode | |
void | dataChanged () |
Emitted on internal data change so the layer tree model can forward the signal to views. | |
void | sizeChanged () |
Emitted when the size of this node changes. | |
Protected Member Functions inherited from QgsLayerTreeModelLegendNode | |
QgsLayerTreeModelLegendNode (QgsLayerTreeLayer *nodeL, QObject *parent=nullptr) | |
Construct the node with pointer to its parent layer node. | |
QgsRenderContext * | createTemporaryRenderContext () const |
Returns a temporary context or nullptr if legendMapViewData are not valid. | |
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 WMS legend entries.
Definition at line 730 of file qgslayertreemodellegendnode.h.
QgsWmsLegendNode::QgsWmsLegendNode | ( | QgsLayerTreeLayer * | nodeLayer, |
QObject * | parent = nullptr |
||
) |
Constructor for QgsWmsLegendNode.
nodeLayer | layer node |
parent | attach a parent QObject to the legend node. |
Definition at line 1279 of file qgslayertreemodellegendnode.cpp.
|
overridedefault |
|
overridevirtual |
Returns data associated with the item. Must be implemented in derived class.
Implements QgsLayerTreeModelLegendNode.
Definition at line 1333 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 1350 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 1401 of file qgslayertreemodellegendnode.cpp.
QImage QgsWmsLegendNode::getLegendGraphicBlocking | ( | ) | const |
Fetches the image from the server and returns it.
Definition at line 1479 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Notification from model that information from associated map view has changed.
Default implementation does nothing.
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 1472 of file qgslayertreemodellegendnode.cpp.