QGIS API Documentation  3.0.2-Girona (307d082)
Public Member Functions | List of all members
QgsSimpleLegendNode Class Reference

Implementation of legend node interface for displaying arbitrary label with icon. More...

#include <qgslayertreemodellegendnode.h>

Inheritance diagram for QgsSimpleLegendNode:
Inheritance graph
[legend]

Public Member Functions

 QgsSimpleLegendNode (QgsLayerTreeLayer *nodeLayer, const QString &label, const QIcon &icon=QIcon(), QObject *parent=nullptr, const QString &key=QString())
 Constructor for QgsSimpleLegendNode. More...
 
QVariant data (int role) const override
 Return data associated with the item. Must be implemented in derived class. More...
 
- Public Member Functions inherited from QgsLayerTreeModelLegendNode
virtual ItemMetrics draw (const QgsLegendSettings &settings, ItemContext *ctx)
 Entry point called from QgsLegendRenderer to do the rendering. More...
 
virtual QSizeF drawSymbol (const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const
 Draws symbol on the left side of the item. More...
 
virtual QSizeF drawSymbolText (const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const
 Draws label on the right side of the item. More...
 
virtual Qt::ItemFlags flags () const
 Return item flags associated with the item. Default implementation returns Qt::ItemIsEnabled. 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
 
QgsLayerTreeLayerlayerNode () const
 Return pointer to the parent layer node. More...
 
QgsLayerTreeModelmodel () const
 Return pointer to model owning this legend node. More...
 
virtual bool setData (const QVariant &value, int role)
 Set some data associated with the item. Default implementation does nothing and returns false. More...
 
virtual void setEmbeddedInParent (bool embedded)
 
virtual void setUserLabel (const QString &userLabel)
 
virtual QString userLabel () const
 

Additional Inherited Members

- Public Types inherited from QgsLayerTreeModelLegendNode
enum  LegendNodeRoles { RuleKeyRole = Qt::UserRole, ParentRuleKeyRole }
 
- Signals inherited from QgsLayerTreeModelLegendNode
void dataChanged ()
 Emitted on internal data change so the layer tree model can forward the signal to views. More...
 
- Protected Member Functions inherited from QgsLayerTreeModelLegendNode
 QgsLayerTreeModelLegendNode (QgsLayerTreeLayer *nodeL, QObject *parent=nullptr)
 Construct the node with pointer to its parent layer node. More...
 
QgsRenderContextcreateTemporaryRenderContext () const
 Returns a temporary context or null if legendMapViewData are not valid. More...
 
- Protected Attributes inherited from QgsLayerTreeModelLegendNode
bool mEmbeddedInParent
 
QgsLayerTreeLayermLayerNode = nullptr
 
QString mUserLabel
 

Detailed Description

Implementation of legend node interface for displaying arbitrary label with icon.

Since
QGIS 2.6

Definition at line 267 of file qgslayertreemodellegendnode.h.

Constructor & Destructor Documentation

◆ QgsSimpleLegendNode()

QgsSimpleLegendNode::QgsSimpleLegendNode ( QgsLayerTreeLayer nodeLayer,
const QString &  label,
const QIcon &  icon = QIcon(),
QObject *  parent = nullptr,
const QString &  key = QString() 
)

Constructor for QgsSimpleLegendNode.

Parameters
nodeLayerlayer node
labellabel
iconicon
parentattach a parent QObject to the legend node.
keythe rule key

Definition at line 482 of file qgslayertreemodellegendnode.cpp.

Member Function Documentation

◆ data()

QVariant QgsSimpleLegendNode::data ( int  role) const
overridevirtual

Return data associated with the item. Must be implemented in derived class.

Implements QgsLayerTreeModelLegendNode.

Definition at line 490 of file qgslayertreemodellegendnode.cpp.


The documentation for this class was generated from the following files: