QGIS API Documentation
3.0.2-Girona (307d082)
|
Implementation of legend node interface for displaying preview of vector symbols and their labels and allowing interaction with the symbol / renderer. More...
#include <qgslayertreemodellegendnode.h>
Public Slots | |
void | checkAllItems () |
Checks all items belonging to the same layer as this node. More... | |
void | uncheckAllItems () |
Unchecks all items belonging to the same layer as this node. More... | |
Public Member Functions | |
QgsSymbolLegendNode (QgsLayerTreeLayer *nodeLayer, const QgsLegendSymbolItem &item, QObject *parent=nullptr) | |
Constructor for QgsSymbolLegendNode. More... | |
QVariant | data (int role) const override |
Return 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... | |
Qt::ItemFlags | flags () const override |
Return item flags associated with the item. Default implementation returns Qt::ItemIsEnabled. More... | |
QSize | iconSize () const |
void | invalidateMapBasedData () override |
Notification from model that information from associated map view has changed. More... | |
bool | isScaleOK (double scale) const override |
QSize | minimumIconSize () const |
Calculates the minimum icon size to prevent cropping. More... | |
QSize | minimumIconSize (QgsRenderContext *context) const |
Calculates the minimum icon size to prevent cropping. More... | |
bool | setData (const QVariant &value, int role) override |
Set some data associated with the item. Default implementation does nothing and returns false. More... | |
void | setEmbeddedInParent (bool embedded) override |
void | setIconSize (QSize sz) |
Set the icon size. More... | |
void | setSymbol (QgsSymbol *symbol) |
Sets the symbol to be used by the legend node. More... | |
void | setUserLabel (const QString &userLabel) override |
const QgsSymbol * | symbol () const |
Returns the symbol used by the legend node. 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 | drawSymbolText (const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const |
Draws label on the right side of the item. More... | |
virtual bool | isEmbeddedInParent () const |
QgsLayerTreeLayer * | layerNode () const |
Return pointer to the parent layer node. More... | |
QgsLayerTreeModel * | model () const |
Return pointer to model owning this legend node. More... | |
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... | |
QgsRenderContext * | createTemporaryRenderContext () const |
Returns a temporary context or null if legendMapViewData are not valid. More... | |
Protected Attributes inherited from QgsLayerTreeModelLegendNode | |
bool | mEmbeddedInParent |
QgsLayerTreeLayer * | mLayerNode = nullptr |
QString | mUserLabel |
Implementation of legend node interface for displaying preview of vector symbols and their labels and allowing interaction with the symbol / renderer.
Definition at line 155 of file qgslayertreemodellegendnode.h.
QgsSymbolLegendNode::QgsSymbolLegendNode | ( | QgsLayerTreeLayer * | nodeLayer, |
const QgsLegendSymbolItem & | item, | ||
QObject * | parent = nullptr |
||
) |
Constructor for QgsSymbolLegendNode.
nodeLayer | layer node |
item | the legend symbol item |
parent | attach a parent QObject to the legend node. |
Definition at line 132 of file qgslayertreemodellegendnode.cpp.
|
slot |
Checks all items belonging to the same layer as this node.
Definition at line 210 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Return data associated with the item. Must be implemented in derived class.
Implements QgsLayerTreeModelLegendNode.
Definition at line 255 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Draws symbol on the left side of the item.
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 |
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 342 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Return item flags associated with the item. Default implementation returns Qt::ItemIsEnabled.
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 146 of file qgslayertreemodellegendnode.cpp.
|
inline |
Definition at line 189 of file qgslayertreemodellegendnode.h.
|
overridevirtual |
Notification from model that information from associated map view has changed.
Default implementation does nothing.
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 436 of file qgslayertreemodellegendnode.cpp.
|
inlineoverridevirtual |
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 179 of file qgslayertreemodellegendnode.h.
QSize QgsSymbolLegendNode::minimumIconSize | ( | ) | const |
Calculates the minimum icon size to prevent cropping.
When evaluating the size for multiple icons it is more efficient to create a single render context in advance and use the variant which accepts a QgsRenderContext argument.
Definition at line 155 of file qgslayertreemodellegendnode.cpp.
QSize QgsSymbolLegendNode::minimumIconSize | ( | QgsRenderContext * | context | ) | const |
Calculates the minimum icon size to prevent cropping.
When evaluating the size for multiple icons it is more efficient to create a single render context in advance and call this method instead of minimumIconSize().
Definition at line 161 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Set some data associated with the item. Default implementation does nothing and returns false.
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 319 of file qgslayertreemodellegendnode.cpp.
|
overridevirtual |
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 429 of file qgslayertreemodellegendnode.cpp.
|
inline |
void QgsSymbolLegendNode::setSymbol | ( | QgsSymbol * | symbol | ) |
Sets the symbol to be used by the legend node.
The symbol change is also propagated to the associated vector layer's renderer.
symbol | new symbol for node. Ownership is transferred. |
Definition at line 192 of file qgslayertreemodellegendnode.cpp.
|
inlineoverridevirtual |
Reimplemented from QgsLayerTreeModelLegendNode.
Definition at line 177 of file qgslayertreemodellegendnode.h.
const QgsSymbol * QgsSymbolLegendNode::symbol | ( | ) | const |
Returns the symbol used by the legend node.
Definition at line 187 of file qgslayertreemodellegendnode.cpp.
|
slot |
Unchecks all items belonging to the same layer as this node.
Definition at line 215 of file qgslayertreemodellegendnode.cpp.