QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
The class stores information about one class/rule of a vector layer renderer in a unified way that can be used by legend model for rendering of legend. More...
#include <qgslegendsymbolitem.h>
Public Member Functions | |
QgsLegendSymbolItem ()=default | |
Constructor for QgsLegendSymbolItem. More... | |
QgsLegendSymbolItem (const QgsLegendSymbolItem &other) | |
QgsLegendSymbolItem (QgsSymbol *symbol, const QString &label, const QString &ruleKey, bool checkable=false, int scaleMinDenom=-1, int scaleMaxDenom=-1, int level=0, const QString &parentRuleKey=QString()) | |
Construct item. More... | |
~QgsLegendSymbolItem () | |
QgsDataDefinedSizeLegend * | dataDefinedSizeLegendSettings () const |
Returns extra information for data-defined size legend rendering. More... | |
bool | isCheckable () const |
Returns whether the item is user-checkable - whether renderer supports enabling/disabling it. More... | |
bool | isScaleOK (double scale) const |
Determine whether given scale is within the scale range. Returns true if scale or scale range is invalid (value <= 0) More... | |
QString | label () const |
Returns text label. More... | |
QgsSymbol * | legacyRuleKey () const |
Used for older code that identifies legend entries from symbol pointer within renderer. More... | |
int | level () const |
Indentation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0. More... | |
QgsLegendSymbolItem & | operator= (const QgsLegendSymbolItem &other) |
QString | parentRuleKey () const |
Key of the parent legend node. More... | |
QString | ruleKey () const |
Returns unique identifier of the rule for identification of the item within renderer. More... | |
int | scaleMaxDenom () const |
Max scale denominator of the scale range. More... | |
int | scaleMinDenom () const |
Min scale denominator of the scale range. More... | |
void | setDataDefinedSizeLegendSettings (QgsDataDefinedSizeLegend *settings) |
Sets extra information about data-defined size. More... | |
void | setSymbol (QgsSymbol *s) |
Sets the symbol of the item. More... | |
QgsSymbol * | symbol () const |
Returns associated symbol. May be nullptr . More... | |
The class stores information about one class/rule of a vector layer renderer in a unified way that can be used by legend model for rendering of legend.
Definition at line 36 of file qgslegendsymbolitem.h.
|
default |
Constructor for QgsLegendSymbolItem.
QgsLegendSymbolItem::QgsLegendSymbolItem | ( | QgsSymbol * | symbol, |
const QString & | label, | ||
const QString & | ruleKey, | ||
bool | checkable = false , |
||
int | scaleMinDenom = -1 , |
||
int | scaleMaxDenom = -1 , |
||
int | level = 0 , |
||
const QString & | parentRuleKey = QString() |
||
) |
Construct item.
Does not take ownership of symbol (makes internal clone)
Definition at line 21 of file qgslegendsymbolitem.cpp.
QgsLegendSymbolItem::~QgsLegendSymbolItem | ( | ) |
Definition at line 39 of file qgslegendsymbolitem.cpp.
QgsLegendSymbolItem::QgsLegendSymbolItem | ( | const QgsLegendSymbolItem & | other | ) |
Definition at line 34 of file qgslegendsymbolitem.cpp.
QgsDataDefinedSizeLegend * QgsLegendSymbolItem::dataDefinedSizeLegendSettings | ( | ) | const |
Returns extra information for data-defined size legend rendering.
Normally it returns nullptr
.
Definition at line 92 of file qgslegendsymbolitem.cpp.
|
inline |
Returns whether the item is user-checkable - whether renderer supports enabling/disabling it.
Definition at line 62 of file qgslegendsymbolitem.h.
bool QgsLegendSymbolItem::isScaleOK | ( | double | scale | ) | const |
Determine whether given scale is within the scale range. Returns true
if scale or scale range is invalid (value <= 0)
Definition at line 66 of file qgslegendsymbolitem.cpp.
|
inline |
Returns text label.
Definition at line 58 of file qgslegendsymbolitem.h.
|
inline |
Used for older code that identifies legend entries from symbol pointer within renderer.
Definition at line 65 of file qgslegendsymbolitem.h.
|
inline |
Indentation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0.
Definition at line 83 of file qgslegendsymbolitem.h.
QgsLegendSymbolItem & QgsLegendSymbolItem::operator= | ( | const QgsLegendSymbolItem & | other | ) |
Definition at line 45 of file qgslegendsymbolitem.cpp.
|
inline |
Key of the parent legend node.
For legends with tree hierarchy
Definition at line 89 of file qgslegendsymbolitem.h.
|
inline |
Returns unique identifier of the rule for identification of the item within renderer.
Definition at line 60 of file qgslegendsymbolitem.h.
|
inline |
Max scale denominator of the scale range.
For range 1:1000 to 1:2000 this will return 2000. Value <= 0 means the range is unbounded on this side
Definition at line 80 of file qgslegendsymbolitem.h.
|
inline |
Min scale denominator of the scale range.
For range 1:1000 to 1:2000 this will return 1000. Value <= 0 means the range is unbounded on this side
Definition at line 74 of file qgslegendsymbolitem.h.
void QgsLegendSymbolItem::setDataDefinedSizeLegendSettings | ( | QgsDataDefinedSizeLegend * | settings | ) |
Sets extra information about data-defined size.
If set, this item should be converted to QgsDataDefinedSizeLegendNode rather than QgsSymbolLegendNode instance as usual. Passing nullptr
removes any data-defined size legend settings.
Takes ownership of the settings object.
Definition at line 86 of file qgslegendsymbolitem.cpp.
void QgsLegendSymbolItem::setSymbol | ( | QgsSymbol * | s | ) |
Sets the symbol of the item.
Does not take ownership of symbol – an internal clone is made of the symbol.
Definition at line 79 of file qgslegendsymbolitem.cpp.
|
inline |
Returns associated symbol. May be nullptr
.
Definition at line 56 of file qgslegendsymbolitem.h.