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
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.
-
dataDefinedSizeLegendSettings
(self) → QgsDataDefinedSizeLegend¶ Returns extra information for data-defined size legend rendering. Normally it returns
None
.New in version 3.0.
- Return type
-
isCheckable
(self) → bool¶ Returns whether the item is user-checkable - whether renderer supports enabling/disabling it
- Return type
bool
-
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)- Parameters
scale (float) –
- Return type
bool
-
label
(self) → str¶ Returns text label
- Return type
str
-
legacyRuleKey
(self) → QgsSymbol¶ Used for older code that identifies legend entries from symbol pointer within renderer
- Return type
-
level
(self) → int¶ Indentation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0
- Return type
int
-
parentRuleKey
(self) → str¶ Key of the parent legend node. For legends with tree hierarchy
Note
Parameter parentRuleKey added in QGIS 2.8
- Return type
str
-
ruleKey
(self) → str¶ Returns unique identifier of the rule for identification of the item within renderer
- Return type
str
-
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
- Return type
int
-
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
- Return type
int
-
setDataDefinedSizeLegendSettings
(self, settings: QgsDataDefinedSizeLegend)¶ Sets extra information about data-defined size. If set, this item should be converted to
QgsDataDefinedSizeLegendNode
rather thanQgsSymbolLegendNode
instance as usual. PassingNone
removes any data-defined size legend settings.Takes ownership of the settings object.
New in version 3.0.
- Parameters
settings (QgsDataDefinedSizeLegend) –
-