A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle database.
More...
#include <qgsstylemodel.h>
|
enum | Column { Name = 0
, Tags
} |
| Model columns. More...
|
|
enum | Role {
TypeRole = Qt::UserRole + 1
, TagRole
, EntityName
, SymbolTypeRole
,
IsFavoriteRole
, LayerTypeRole
, CompatibleGeometryTypesRole
, StyleName
,
StyleFileName
, IsTitleRole
} |
| Custom model roles. More...
|
|
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle database.
If you are creating a style model for the default application style (see QgsStyle::defaultStyle()), consider using the shared style model available at QgsApplication::defaultStyleModel() for performance instead.
- See also
- QgsStyleProxyModel
- Since
- QGIS 3.4
Definition at line 107 of file qgsstylemodel.h.
◆ Column
Model columns.
Enumerator |
---|
Name | Name column.
|
Tags | Tags column.
|
Definition at line 114 of file qgsstylemodel.h.
◆ Role
Custom model roles.
Enumerator |
---|
TypeRole | Style entity type, see QgsStyle::StyleEntity.
|
TagRole | String list of tags.
|
EntityName | Entity name (since QGIS 3.26)
|
SymbolTypeRole | Symbol type (for symbol or legend patch shape entities)
|
IsFavoriteRole | Whether entity is flagged as a favorite.
|
LayerTypeRole | Layer type (for label settings entities)
|
CompatibleGeometryTypesRole | Compatible layer geometry types (for 3D symbols)
|
StyleName | Name of associated QgsStyle (QgsStyle::name()) (since QGIS 3.26)
|
StyleFileName | File name of associated QgsStyle (QgsStyle::fileName()) (since QGIS 3.26)
|
IsTitleRole | True if the index corresponds to a title item (since QGIS 3.26)
|
Definition at line 121 of file qgsstylemodel.h.
◆ QgsStyleModel()
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.
Definition at line 60 of file qgsstylemodel.cpp.
◆ addDesiredIconSize()
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.
Definition at line 586 of file qgsstylemodel.cpp.
◆ columnCount()
int QgsStyleModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
◆ data()
QVariant QgsStyleModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role |
|
) |
| const |
|
override |
◆ flags()
Qt::ItemFlags QgsStyleModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
override |
◆ headerData()
QVariant QgsStyleModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
override |
◆ index()
QModelIndex QgsStyleModel::index |
( |
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent = QModelIndex() |
|
) |
| const |
|
override |
◆ parent()
QModelIndex QgsStyleModel::parent |
( |
const QModelIndex & |
index | ) |
const |
|
override |
◆ rowCount()
int QgsStyleModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
◆ setData()
bool QgsStyleModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
override |
◆ setIconGenerator()
Sets the icon generator to use for deferred style entity icon generation.
Currently this is used for 3D symbol icons only.
- Note
- Not available in Python bindings
- Since
- QGIS 3.16
Definition at line 599 of file qgsstylemodel.cpp.
◆ style()
Returns the style managed by the model.
- Since
- QGIS 3.10
Definition at line 147 of file qgsstylemodel.h.
◆ QgsCombinedStyleModel
The documentation for this class was generated from the following files: