QgsRendererCategory class

Represents an individual category (class) from a QgsCategorizedSymbolRenderer.

Constructors, destructors, conversion operators

QgsRendererCategory() defaulted
Constructor for QgsRendererCategory.
QgsRendererCategory(const QVariant& value, QgsSymbol* symbol, const QString& label, bool render = true)
Constructor for a new QgsRendererCategory, with the specified value and symbol.
QgsRendererCategory(const QgsRendererCategory& cat)
Copy constructor.

Public functions

auto dump() const -> QString
Returns a string representing the categories settings, used for debugging purposes only.
auto label() const -> QString
Returns the label for this category, which is used to represent the category within legends and the layer tree.
auto renderState() const -> bool
Returns true if the category is currently enabled and should be rendered.
void setLabel(const QString& label)
Sets the label for this category, which is used to represent the category within legends and the layer tree.
void setRenderState(bool render)
Sets whether the category is currently enabled and should be rendered.
void setSymbol(QgsSymbol* s)
Sets the symbol which will be used to render this category.
void setValue(const QVariant& value)
Sets the value corresponding to this category.
auto symbol() const -> QgsSymbol*
Returns the symbol which will be used to render this category.
void toSld(QDomDocument& doc, QDomElement& element, QgsStringMap props) const
Converts the category to a matching SLD rule, within the specified DOM document and element.
auto value() const -> QVariant
Returns the value corresponding to this category.

Function documentation

QgsRendererCategory::QgsRendererCategory(const QVariant& value, QgsSymbol* symbol, const QString& label, bool render = true)

Constructor for a new QgsRendererCategory, with the specified value and symbol.

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.

QString QgsRendererCategory::label() const

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

bool QgsRendererCategory::renderState() const

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

void QgsRendererCategory::setLabel(const QString& label)

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

void QgsRendererCategory::setRenderState(bool render)

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

void QgsRendererCategory::setSymbol(QgsSymbol* s)

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

Ownership of the symbol is transferred to the category.

void QgsRendererCategory::setValue(const QVariant& value)

Sets the value corresponding to this category.

If value is a list, then the category will match any of the values from this list.

QgsSymbol* QgsRendererCategory::symbol() const

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

QVariant QgsRendererCategory::value() const

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.