16 #ifndef QGSSTYLEMODEL_H
17 #define QGSSTYLEMODEL_H
19 #include "qgis_core.h"
23 #include <QAbstractItemModel>
24 #include <QSortFilterProxyModel>
67 void setIconSizes(
const QList< QSize > &sizes );
74 QList< QSize > iconSizes()
const;
86 QList< QSize > mIconSizes;
123 TypeRole = Qt::UserRole + 1,
145 QVariant data(
const QModelIndex &index,
int role )
const override;
146 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
147 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
148 QVariant headerData(
int section, Qt::Orientation orientation,
149 int role = Qt::DisplayRole )
const override;
150 QModelIndex index(
int row,
int column,
151 const QModelIndex &parent = QModelIndex() )
const override;
152 QModelIndex parent(
const QModelIndex &index )
const override;
153 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
154 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
162 void addDesiredIconSize( QSize size );
180 void onTagsChanged(
int entity,
const QString &name,
const QStringList &tags );
181 void rebuildSymbolIcons();
188 QHash< QgsStyle::StyleEntity, QStringList > mEntityNames;
190 QList< QSize > mAdditionalSizes;
191 mutable std::unique_ptr< QgsExpressionContext > mExpressionContext;
193 mutable QHash< QgsStyle::StyleEntity, QHash< QString, QIcon > > mIconCache;
196 mutable QSet< QString > mPending3dSymbolIcons;
267 void setEntityFilters(
const QList<QgsStyle::StyleEntity> &filters )
SIP_SKIP;
275 bool entityFilterEnabled()
const;
286 void setEntityFilterEnabled(
bool enabled );
313 bool symbolTypeFilterEnabled()
const;
325 void setSymbolTypeFilterEnabled(
bool enabled );
353 void setTagId(
int id );
372 void setSmartGroupId(
int id );
381 int smartGroupId()
const;
383 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
390 bool favoritesOnly()
const;
397 void setFavoritesOnly(
bool favoritesOnly );
405 void addDesiredIconSize( QSize size );
415 void setFilterString(
const QString &filter );
424 QString mFilterString;
427 QStringList mTaggedSymbolNames;
429 int mSmartGroupId = -1;
430 QStringList mSmartGroupSymbolNames;
432 bool mFavoritesOnly =
false;
434 bool mEntityFilterEnabled =
false;
435 QList< QgsStyle::StyleEntity > mEntityFilters = QList< QgsStyle::StyleEntity >() <<
QgsStyle::SymbolEntity;
437 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 QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
QgsStyle * style()
Returns the style managed by the model.
@ LayerTypeRole
Layer type (for label settings entities)
@ 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)
@ TagRole
String list of tags.
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.
SymbolType
Type of the symbol.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.