Class: QgsRendererCategory

class qgis.core.QgsRendererCategory

Bases: sip.wrapper

Constructor for QgsRendererCategory.

QgsRendererCategory(value: Any, symbol: QgsSymbol, label: str, render: bool = True) Constructor for a new QgsRendererCategory, with the specified value and symbol.

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.

QgsRendererCategory(cat: QgsRendererCategory) Copy constructor.

Represents an individual category (class) from a QgsCategorizedSymbolRenderer.

Enums

Methods

dump

Returns a string representing the categories settings, used for debugging purposes only.

label

Returns the label for this category, which is used to represent the category within legends and the layer tree.

renderState

Returns true if the category is currently enabled and should be rendered.

setLabel

Sets the label for this category, which is used to represent the category within legends and the layer tree.

setRenderState

Sets whether the category is currently enabled and should be rendered.

setSymbol

Sets the symbol which will be used to render this category.

setValue

Sets the value corresponding to this category.

swap

symbol

Returns the symbol which will be used to render this category.

toSld

Converts the category to a matching SLD rule, within the specified DOM document and element.

value

Returns the value corresponding to this category.

Signals

Attributes

dump(self) → str

Returns a string representing the categories settings, used for debugging purposes only.

label(self) → str

Returns the label for this category, which is used to represent the category within legends and the layer tree.

See also

setLabel()

renderState(self) → bool

Returns true if the category is currently enabled and should be rendered.

See also

setRenderState()

New in version 2.5.

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

label()

setRenderState(self, render: bool)

Sets whether the category is currently enabled and should be rendered.

See also

renderState()

New in version 2.5.

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

symbol()

setValue(self, value: Any)

Sets the value corresponding to this category.

See also

value()

swap(self, other: QgsRendererCategory)
symbol(self) → QgsSymbol

Returns the symbol which will be used to render this category.

See also

setSymbol()

toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])

Converts the category to a matching SLD rule, within the specified DOM document and element.

value(self) → Any

Returns the value corresponding to this category.

See also

setValue()