Class: QgsLegendSymbolItem¶
-
class
qgis.core.
QgsLegendSymbolItem
¶ Bases:
sip.wrapper
Constructor for QgsLegendSymbolItem.
QgsLegendSymbolItem(symbol: QgsSymbol, label: str, ruleKey: str, checkable: bool = False, scaleMinDenom: int = -1, scaleMaxDenom: int = -1, level: int = 0, parentRuleKey: str = ‘’) Construct item. Does not take ownership of symbol (makes internal clone)
New in version 2.8.
QgsLegendSymbolItem(other: QgsLegendSymbolItem)
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.
See also
New in version 2.6: Enums
Methods
Returns extra information for data-defined size legend rendering.
Returns whether the item is user-checkable - whether renderer supports enabling/disabling it
Determine whether given scale is within the scale range.
Returns text label
Used for older code that identifies legend entries from symbol pointer within renderer
Indentation level that tells how deep the item is in a hierarchy of items.
Key of the parent legend node.
Returns unique identifier of the rule for identification of the item within renderer
Max scale denominator of the scale range.
Min scale denominator of the scale range.
Sets extra information about data-defined size.
Sets the symbol of the item.
Returns associated symbol.
Signals
Attributes
-
dataDefinedSizeLegendSettings
(self) → QgsDataDefinedSizeLegend¶ Returns extra information for data-defined size legend rendering. Normally it returns null.
New in version 3.0.
-
isCheckable
(self) → bool¶ Returns whether the item is user-checkable - whether renderer supports enabling/disabling it
-
isScaleOK
(self, scale: float) → bool¶ Determine whether given scale is within the scale range. Returns true if scale or scale range is invalid (value <= 0)
-
label
(self) → str¶ Returns text label
-
legacyRuleKey
(self) → QgsSymbol¶ Used for older code that identifies legend entries from symbol pointer within renderer
-
level
(self) → int¶ Indentation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0
-
parentRuleKey
(self) → str¶ Key of the parent legend node. For legends with tree hierarchy
Note
Parameter parentRuleKey added in QGIS 2.8
-
ruleKey
(self) → str¶ Returns unique identifier of the rule for identification of the item within renderer
-
scaleMaxDenom
(self) → int¶ 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
-
scaleMinDenom
(self) → int¶ 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
-
setDataDefinedSizeLegendSettings
(self, settings: QgsDataDefinedSizeLegend)¶ 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.
New in version 3.0.
-
setSymbol
(self, s: QgsSymbol)¶ Sets the symbol of the item.
Does not take ownership of symbol – an internal clone is made of the symbol.
See also
-
symbol
(self) → QgsSymbol¶ Returns associated symbol. May be null.
-