16#ifndef QGSSTYLEMODEL_H
17#define QGSSTYLEMODEL_H
23#include <QAbstractItemModel>
26#include <QSortFilterProxyModel>
109 QList< QSize > mIconSizes;
110 QSet< QgsScreenProperties > mTargetScreenProperties;
182 QVariant data(
const QModelIndex &index,
int role )
const override;
183 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
184 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
185 QVariant headerData(
int section, Qt::Orientation orientation,
186 int role = Qt::DisplayRole )
const override;
187 QModelIndex index(
int row,
int column,
188 const QModelIndex &parent = QModelIndex() )
const override;
189 QModelIndex parent(
const QModelIndex &index )
const override;
190 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
191 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
199 void addDesiredIconSize( QSize size );
228 void onTagsChanged(
int entity,
const QString &name,
const QStringList &tags );
229 void rebuildSymbolIcons();
234 void initStyleModel();
238 QHash< QgsStyle::StyleEntity, QStringList > mEntityNames;
240 QSet< QgsScreenProperties > mTargetScreenProperties;
242 QList< QSize > mAdditionalSizes;
243 mutable std::unique_ptr< QgsExpressionContext > mExpressionContext;
245 mutable QHash< QgsStyle::StyleEntity, QHash< QString, QIcon > > mIconCache;
248 mutable QSet< QString > mPending3dSymbolIcons;
253 static QVariant headerDataStatic(
int section, Qt::Orientation orientation,
254 int role = Qt::DisplayRole );
333 void setEntityFilters(
const QList<QgsStyle::StyleEntity> &filters )
SIP_SKIP;
341 bool entityFilterEnabled()
const;
352 void setEntityFilterEnabled(
bool enabled );
379 bool symbolTypeFilterEnabled()
const;
391 void setSymbolTypeFilterEnabled(
bool enabled );
421 void setTagId(
int id );
443 void setTagString(
const QString &tag );
453 QString tagString()
const;
465 void setSmartGroupId(
int id );
476 int smartGroupId()
const;
478 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
479 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
486 bool favoritesOnly()
const;
493 void setFavoritesOnly(
bool favoritesOnly );
501 void addDesiredIconSize( QSize size );
521 void setFilterString(
const QString &filter );
531 QString mFilterString;
534 QStringList mTaggedSymbolNames;
538 int mSmartGroupId = -1;
539 QStringList mSmartGroupSymbolNames;
541 bool mFavoritesOnly =
false;
543 bool mEntityFilterEnabled =
false;
544 QList< QgsStyle::StyleEntity > mEntityFilters = QList< QgsStyle::StyleEntity >() <<
QgsStyle::SymbolEntity;
546 bool mSymbolTypeFilterEnabled =
false;
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
An abstract base class for icon generators for a QgsStyleModel.
void setTargetScreenProperties(const QSet< QgsScreenProperties > &properties)
Sets the target screen properties to use when generating icons.
void setIconSizes(const QList< QSize > &sizes)
Sets the list of icon sizes to generate.
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 ...
QgsAbstractStyleEntityIconGenerator(QObject *parent)
Constructor for QgsAbstractStyleEntityIconGenerator, with the specified parent object.
QSet< QgsScreenProperties > targetScreenProperties() const
Returns the target screen properties to use when generating icons.
QList< QSize > iconSizes() const
Returns the list of icon sizes to generate.
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.
Stores properties relating to a screen.
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
CustomRole
Custom model roles.
friend class QgsCombinedStyleModel
QgsStyleModel(QgsStyle *style, QObject *parent=nullptr)
Constructor for QgsStyleModel, for the specified style and parent object.
QgsStyle * style()
Returns the style managed by the model.
QString filterString() const
Returns the current filter string, if set.
QgsStyleProxyModel(QgsStyle *style, QObject *parent=nullptr)
Constructor for QgsStyleProxyModel, for the specified style and parent object.
A database of saved style entities, including symbols, color ramps, text formats and others.
StyleEntity
Enum for Entities involved in a style.
Abstract base class for all rendered symbols.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)