Class: QgsMapLayerStyleCategoriesModel

Model for layer style categories

Added in version 3.14.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapLayerStyleCategoriesModel

Base classes

QAbstractListModel

QAbstractItemModel

QObject

Enums

Role

Custom model roles

Methods

categories

Returns the categories as defined in the model

setCategories

Reset the model data

setShowAllCategories

Defines if the model should list the AllStyleCategories entry

class qgis.gui.QgsMapLayerStyleCategoriesModel[source]

Bases: QAbstractListModel

__init__(type: Qgis.LayerType, parent: QObject | None = None)

Constructor for QgsMapLayerStyleCategoriesModel, for the specified layer type.

Parameters:
class Role(*values)

Bases: IntEnum

Custom model roles

  • NameRole:

NameRole = 257
categories(self) QgsMapLayer.StyleCategories[source]

Returns the categories as defined in the model

Return type:

QgsMapLayer.StyleCategories

setCategories(self, categories: QgsMapLayer.StyleCategories | QgsMapLayer.StyleCategory)[source]

Reset the model data

Parameters:

categories (Union[QgsMapLayer.StyleCategories, QgsMapLayer.StyleCategory])

setShowAllCategories(self, showAll: bool)[source]

Defines if the model should list the AllStyleCategories entry

Parameters:

showAll (bool)