16#ifndef QGSSTYLEMODEL_H
17#define QGSSTYLEMODEL_H
22#include <QAbstractItemModel>
23#include <QSortFilterProxyModel>
67 void setIconSizes(
const QList< QSize > &sizes );
74 QList< QSize > iconSizes()
const;
86 QList< QSize > mIconSizes;
123 TypeRole = Qt::UserRole + 1,
149 QVariant data(
const QModelIndex &index,
int role )
const override;
150 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
151 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
152 QVariant headerData(
int section, Qt::Orientation orientation,
153 int role = Qt::DisplayRole )
const override;
154 QModelIndex index(
int row,
int column,
155 const QModelIndex &parent = QModelIndex() )
const override;
156 QModelIndex parent(
const QModelIndex &index )
const override;
157 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
158 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
166 void addDesiredIconSize( QSize size );
185 void onTagsChanged(
int entity,
const QString &name,
const QStringList &tags );
186 void rebuildSymbolIcons();
193 QHash< QgsStyle::StyleEntity, QStringList > mEntityNames;
195 QList< QSize > mAdditionalSizes;
196 mutable std::unique_ptr< QgsExpressionContext > mExpressionContext;
198 mutable QHash< QgsStyle::StyleEntity, QHash< QString, QIcon > > mIconCache;
201 mutable QSet< QString > mPending3dSymbolIcons;
206 static QVariant headerDataStatic(
int section, Qt::Orientation orientation,
207 int role = Qt::DisplayRole );
286 void setEntityFilters(
const QList<QgsStyle::StyleEntity> &filters )
SIP_SKIP;
294 bool entityFilterEnabled()
const;
305 void setEntityFilterEnabled(
bool enabled );
332 bool symbolTypeFilterEnabled()
const;
344 void setSymbolTypeFilterEnabled(
bool enabled );
374 void setTagId(
int id );
396 void setTagString(
const QString &tag );
406 QString tagString()
const;
418 void setSmartGroupId(
int id );
429 int smartGroupId()
const;
431 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
432 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
439 bool favoritesOnly()
const;
446 void setFavoritesOnly(
bool favoritesOnly );
454 void addDesiredIconSize( QSize size );
464 void setFilterString(
const QString &filter );
474 QString mFilterString;
477 QStringList mTaggedSymbolNames;
481 int mSmartGroupId = -1;
482 QStringList mSmartGroupSymbolNames;
484 bool mFavoritesOnly =
false;
486 bool mEntityFilterEnabled =
false;
487 QList< QgsStyle::StyleEntity > mEntityFilters = QList< QgsStyle::StyleEntity >() <<
QgsStyle::SymbolEntity;
489 bool mSymbolTypeFilterEnabled =
false;
An abstract base class for icon generators for a QgsStyleModel.
virtual void generateIcon(QgsStyle *style, QgsStyle::StyleEntity type, const QString &name)=0
Triggers generation of an icon for an entity from the specified style database, with matching entity ...
void iconGenerated(QgsStyle::StyleEntity type, const QString &name, const QIcon &icon)
Emitted when the icon for the style entity with matching type and name has been generated.
A model which contains entities from multiple QgsStyle databases.
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
@ StyleName
Name of associated QgsStyle (QgsStyle::name()) (since QGIS 3.26)
@ LayerTypeRole
Layer type (for label settings entities)
@ StyleFileName
File name of associated QgsStyle (QgsStyle::fileName()) (since QGIS 3.26)
@ EntityName
Entity name (since QGIS 3.26)
@ CompatibleGeometryTypesRole
Compatible layer geometry types (for 3D symbols)
@ IsFavoriteRole
Whether entity is flagged as a favorite.
@ SymbolTypeRole
Symbol type (for symbol or legend patch shape entities)
@ IsTitleRole
True if the index corresponds to a title item (since QGIS 3.26)
@ TagRole
String list of tags.
QgsStyle * style()
Returns the style managed by the model.
A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle ...
QString filterString() const
Returns the current filter string, if set.
StyleEntity
Enum for Entities involved in a style.
Abstract base class for all rendered symbols.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.