Class: QgsRendererCategory¶
- class qgis.core.QgsRendererCategory¶
Bases:
sip.wrapper
Represents an individual category (class) from a
QgsCategorizedSymbolRenderer
.QgsRendererCategory() Constructor for QgsRendererCategory.
QgsRendererCategory(value: Any, symbol:
QgsSymbol
, label: str, render: bool = True, uuid: str = ‘’) Constructor for a newQgsRendererCategory
, with the specifiedvalue
andsymbol
.If
value
is a list, then the category will match any of the values from this list.The ownership of
symbol
is transferred to the category.The
label
argument specifies the label used for this category in legends and the layer tree.The
render
argument indicates whether the category should initially be rendered and appear checked in the layer tree.The optional
uuid
argument manually set the UUID key identifier for the category (since QGIS 3.34).QgsRendererCategory(cat:
QgsRendererCategory
) Copy constructor.Methods
Returns a string representing the categories settings, used for debugging purposes only.
Returns the label for this category, which is used to represent the category within legends and the layer tree.
Returns
True
if the category is currently enabled and should be rendered.Sets the
label
for this category, which is used to represent the category within legends and the layer tree.Sets whether the category is currently enabled and should be rendered.
Sets the symbol which will be used to render this category.
Sets the
value
corresponding to this category.- param other:
Returns the symbol which will be used to render this category.
Converts the category to a matching SLD rule, within the specified DOM document and
element
.Returns the unique identifier for this category.
Returns the value corresponding to this category.
- dump(self) str ¶
Returns a string representing the categories settings, used for debugging purposes only.
- Return type:
str
- label(self) str ¶
Returns the label for this category, which is used to represent the category within legends and the layer tree.
See also
- Return type:
str
- renderState(self) bool ¶
Returns
True
if the category is currently enabled and should be rendered.See also
- Return type:
bool
- setLabel(self, label: str)¶
Sets the
label
for this category, which is used to represent the category within legends and the layer tree.See also
- Parameters:
label (str) –
- setRenderState(self, render: bool)¶
Sets whether the category is currently enabled and should be rendered.
See also
- Parameters:
render (bool) –
- setSymbol(self, s: QgsSymbol)¶
Sets the symbol which will be used to render this category.
Ownership of the symbol is transferred to the category.
See also
- Parameters:
s (QgsSymbol) –
- setValue(self, value: Any)¶
Sets the
value
corresponding to this category.If
value
is a list, then the category will match any of the values from this list.See also
- Parameters:
value (Any) –
- swap(self, other: QgsRendererCategory)¶
- Parameters:
other (QgsRendererCategory) –
- symbol(self) QgsSymbol ¶
Returns the symbol which will be used to render this category.
See also
- Return type:
- toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, Any])¶
Converts the category to a matching SLD rule, within the specified DOM document and
element
.- Parameters:
doc (QDomDocument) –
element (QDomElement) –
props (Dict[str) –
- uuid(self) str ¶
Returns the unique identifier for this category.
New in version 3.34.
- Return type:
str
- value(self) Any ¶
Returns the value corresponding to this category.
If the returned value is a list, then the category will match any of the values from this list.
See also
- Return type:
Any