16 #ifndef QGSSTYLEMODEL_H
17 #define QGSSTYLEMODEL_H
19 #include "qgis_core.h"
22 #include <QAbstractItemModel>
23 #include <QSortFilterProxyModel>
66 void setIconSizes(
const QList< QSize > &sizes );
73 QList< QSize > iconSizes()
const;
85 QList< QSize > mIconSizes;
122 TypeRole = Qt::UserRole + 1,
144 QVariant data(
const QModelIndex &index,
int role )
const override;
145 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
146 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
147 QVariant headerData(
int section, Qt::Orientation orientation,
148 int role = Qt::DisplayRole )
const override;
149 QModelIndex index(
int row,
int column,
150 const QModelIndex &parent = QModelIndex() )
const override;
151 QModelIndex parent(
const QModelIndex &index )
const override;
152 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
153 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
161 void addDesiredIconSize( QSize size );
179 void onTagsChanged(
int entity,
const QString &name,
const QStringList &tags );
180 void rebuildSymbolIcons();
187 QHash< QgsStyle::StyleEntity, QStringList > mEntityNames;
189 QList< QSize > mAdditionalSizes;
190 mutable std::unique_ptr< QgsExpressionContext > mExpressionContext;
192 mutable QHash< QgsStyle::StyleEntity, QHash< QString, QIcon > > mIconCache;
195 mutable QSet< QString > mPending3dSymbolIcons;
266 void setEntityFilters(
const QList<QgsStyle::StyleEntity> &filters )
SIP_SKIP;
274 bool entityFilterEnabled()
const;
285 void setEntityFilterEnabled(
bool enabled );
312 bool symbolTypeFilterEnabled()
const;
324 void setSymbolTypeFilterEnabled(
bool enabled );
352 void setTagId(
int id );
371 void setSmartGroupId(
int id );
380 int smartGroupId()
const;
382 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
389 bool favoritesOnly()
const;
396 void setFavoritesOnly(
bool favoritesOnly );
404 void addDesiredIconSize( QSize size );
414 void setFilterString(
const QString &filter );
423 QString mFilterString;
426 QStringList mTaggedSymbolNames;
428 int mSmartGroupId = -1;
429 QStringList mSmartGroupSymbolNames;
431 bool mFavoritesOnly =
false;
433 bool mEntityFilterEnabled =
false;
434 QList< QgsStyle::StyleEntity > mEntityFilters = QList< QgsStyle::StyleEntity >() <<
QgsStyle::SymbolEntity;
436 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.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.