QgsLegendSymbolItem class
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.
Contents
Constructors, destructors, conversion operators
- QgsLegendSymbolItem() defaulted
- Constructor for 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.
Public functions
- auto dataDefinedSizeLegendSettings() const -> QgsDataDefinedSizeLegend*
- Returns extra information for data-defined size legend rendering.
- auto isCheckable() const -> bool
- Returns whether the item is user-checkable - whether renderer supports enabling/disabling it.
- auto isScaleOK(double scale) const -> bool
- Determine whether given scale is within the scale range. Returns true if scale or scale range is invalid (value <= 0)
- auto label() const -> QString
- Returns text label.
- auto legacyRuleKey() const -> QgsSymbol*
- Used for older code that identifies legend entries from symbol pointer within renderer.
- auto level() const -> int
- Indentation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0.
- auto parentRuleKey() const -> QString
- Key of the parent legend node.
- auto ruleKey() const -> QString
- Returns unique identifier of the rule for identification of the item within renderer.
- auto scaleMaxDenom() const -> int
- Max scale denominator of the scale range.
- auto scaleMinDenom() const -> int
- Min scale denominator of the scale range.
- void setDataDefinedSizeLegendSettings(QgsDataDefinedSizeLegend* settings)
- Sets extra information about data-defined size.
- void setSymbol(QgsSymbol* s)
- Sets the symbol of the item.
- auto symbol() const -> QgsSymbol*
- Returns associated symbol. May be null.
Function documentation
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)
QgsDataDefinedSizeLegend* QgsLegendSymbolItem:: dataDefinedSizeLegendSettings() const
Returns extra information for data-defined size legend rendering.
Normally it returns null.
QString QgsLegendSymbolItem:: parentRuleKey() const
Key of the parent legend node.
For legends with tree hierarchy
int QgsLegendSymbolItem:: scaleMaxDenom() const
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
int QgsLegendSymbolItem:: scaleMinDenom() const
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
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 null removes any data-defined size legend settings.
Takes ownership of the settings object.