QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle database. More...
#include <qgsstylemodel.h>
Public Types | |
enum | Column { Name = 0, Tags } |
Model columns. More... | |
enum | Role { TypeRole = Qt::UserRole + 1, TagRole, SymbolTypeRole, IsFavoriteRole, LayerTypeRole, CompatibleGeometryTypesRole } |
Custom model roles. More... | |
Public Member Functions | |
QgsStyleModel (QgsStyle *style, QObject *parent=nullptr) | |
Constructor for QgsStyleModel, for the specified style and parent object. More... | |
void | addDesiredIconSize (QSize size) |
Adds an additional icon size to generate for Qt::DecorationRole data. More... | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role) const override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | parent (const QModelIndex &index) const override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
QgsStyle * | style () |
Returns the style managed by the model. More... | |
Static Public Member Functions | |
static void | setIconGenerator (QgsAbstractStyleEntityIconGenerator *generator) |
Sets the icon generator to use for deferred style entity icon generation. 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.
Definition at line 107 of file qgsstylemodel.h.
Model columns.
Enumerator | |
---|---|
Name | Name column. |
Tags | Tags column. |
Definition at line 114 of file qgsstylemodel.h.
enum QgsStyleModel::Role |
Custom model roles.
Enumerator | |
---|---|
TypeRole | Style entity type, see QgsStyle::StyleEntity. |
TagRole | String list of tags. |
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) |
Definition at line 121 of file qgsstylemodel.h.
|
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 57 of file qgsstylemodel.cpp.
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 587 of file qgsstylemodel.cpp.
|
override |
Definition at line 582 of file qgsstylemodel.cpp.
|
override |
Definition at line 90 of file qgsstylemodel.cpp.
|
override |
Definition at line 509 of file qgsstylemodel.cpp.
|
override |
Definition at line 522 of file qgsstylemodel.cpp.
|
override |
Definition at line 551 of file qgsstylemodel.cpp.
|
override |
Definition at line 564 of file qgsstylemodel.cpp.
|
override |
Definition at line 570 of file qgsstylemodel.cpp.
|
override |
Definition at line 476 of file qgsstylemodel.cpp.
|
static |
Sets the icon generator to use for deferred style entity icon generation.
Currently this is used for 3D symbol icons only.
Definition at line 600 of file qgsstylemodel.cpp.
|
inline |
Returns the style managed by the model.
Definition at line 143 of file qgsstylemodel.h.