16 #ifndef QGSSTYLEMODEL_H
17 #define QGSSTYLEMODEL_H
19 #include "qgis_core.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 );
242 #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
291 void setEntityFilters(
const QList<QgsStyle::StyleEntity> &filters )
SIP_SKIP;
299 bool entityFilterEnabled()
const;
310 void setEntityFilterEnabled(
bool enabled );
337 bool symbolTypeFilterEnabled()
const;
349 void setSymbolTypeFilterEnabled(
bool enabled );
379 void setTagId(
int id );
401 void setTagString(
const QString &tag );
411 QString tagString()
const;
423 void setSmartGroupId(
int id );
434 int smartGroupId()
const;
436 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
437 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
444 bool favoritesOnly()
const;
451 void setFavoritesOnly(
bool favoritesOnly );
459 void addDesiredIconSize( QSize size );
469 void setFilterString(
const QString &filter );
476 #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
481 QString mFilterString;
484 QStringList mTaggedSymbolNames;
488 int mSmartGroupId = -1;
489 QStringList mSmartGroupSymbolNames;
491 bool mFavoritesOnly =
false;
493 bool mEntityFilterEnabled =
false;
494 QList< QgsStyle::StyleEntity > mEntityFilters = QList< QgsStyle::StyleEntity >() <<
QgsStyle::SymbolEntity;
496 bool mSymbolTypeFilterEnabled =
false;
503 #endif //QGSSTYLEMODEL_H