QgsStyleModel class

A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle database.

Public types

enum Column { Name = 0, Tags }
Model columns.
enum Role { TypeRole = Qt::UserRole + 1, TagRole, SymbolTypeRole }
Custom model roles.

Constructors, destructors, conversion operators

QgsStyleModel(QgsStyle* style, QObject* parent = nullptr) explicit
Constructor for QgsStyleModel, for the specified style and parent object.

Public functions

void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.

Enum documentation

enum QgsStyleModel::Column

Model columns.

Enumerators
Name

Name column.

Tags

Tags column.

enum QgsStyleModel::Role

Custom model roles.

Enumerators
TypeRole

Style entity type, see QgsStyle::StyleEntity.

TagRole

String list of tags.

SymbolTypeRole

Symbol type (for symbol entities)

Function documentation

QgsStyleModel::QgsStyleModel(QgsStyle* style, QObject* parent = nullptr) explicit

Constructor for QgsStyleModel, for the specified style and parent object.

The style object must exist for the lifetime of this model.

void QgsStyleModel::addDesiredIconSize(QSize size)

Adds an additional icon size to generate for Qt::DecorationRole data.

This allows style icons to be generated at an icon size which corresponds exactly to the view's icon size in which this model is used.