16 #ifndef QGSSTYLEMODEL_H 17 #define QGSSTYLEMODEL_H 19 #include "qgis_core.h" 23 #include <QAbstractItemModel> 24 #include <QSortFilterProxyModel> 61 TypeRole = Qt::UserRole + 1,
82 QVariant data(
const QModelIndex &index,
int role )
const override;
83 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
84 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
85 QVariant headerData(
int section, Qt::Orientation orientation,
86 int role = Qt::DisplayRole )
const override;
87 QModelIndex index(
int row,
int column,
88 const QModelIndex &parent = QModelIndex() )
const override;
89 QModelIndex parent(
const QModelIndex &index )
const override;
90 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
91 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
99 void addDesiredIconSize( QSize size );
103 void onSymbolAdded(
const QString &name,
QgsSymbol *symbol );
104 void onSymbolRemoved(
const QString &name );
105 void onSymbolChanged(
const QString &name );
106 void onSymbolRename(
const QString &oldName,
const QString &newName );
107 void onRampAdded(
const QString &name );
108 void onRampRemoved(
const QString &name );
109 void onRampChanged(
const QString &name );
110 void onRampRename(
const QString &oldName,
const QString &newName );
112 void onTextFormatAdded(
const QString &name );
113 void onTextFormatRemoved(
const QString &name );
114 void onTextFormatChanged(
const QString &name );
115 void onTextFormatRename(
const QString &oldName,
const QString &newName );
117 void onLabelSettingsAdded(
const QString &name );
118 void onLabelSettingsRemoved(
const QString &name );
119 void onLabelSettingsChanged(
const QString &name );
120 void onLabelSettingsRename(
const QString &oldName,
const QString &newName );
122 void onTagsChanged(
int entity,
const QString &name,
const QStringList &tags );
123 void rebuildSymbolIcons();
128 QStringList mSymbolNames;
129 QStringList mRampNames;
130 QStringList mTextFormatNames;
131 QStringList mLabelSettingsNames;
132 QList< QSize > mAdditionalSizes;
133 mutable std::unique_ptr< QgsExpressionContext > mExpressionContext;
135 mutable QHash< QString, QIcon > mSymbolIconCache;
136 mutable QHash< QString, QIcon > mColorRampIconCache;
137 mutable QHash< QString, QIcon > mTextFormatIconCache;
138 mutable QHash< QString, QIcon > mLabelSettingsIconCache;
207 void setEntityFilters(
const QList<QgsStyle::StyleEntity> &filters )
SIP_SKIP;
215 bool entityFilterEnabled()
const;
226 void setEntityFilterEnabled(
bool enabled );
253 bool symbolTypeFilterEnabled()
const;
265 void setSymbolTypeFilterEnabled(
bool enabled );
293 void setTagId(
int id );
312 void setSmartGroupId(
int id );
321 int smartGroupId()
const;
323 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
330 bool favoritesOnly()
const;
337 void setFavoritesOnly(
bool favoritesOnly );
345 void addDesiredIconSize( QSize size );
355 void setFilterString(
const QString &filter );
364 QString mFilterString;
367 QStringList mTaggedSymbolNames;
369 int mSmartGroupId = -1;
370 QStringList mSmartGroupSymbolNames;
372 bool mFavoritesOnly =
false;
374 bool mEntityFilterEnabled =
false;
375 QList< QgsStyle::StyleEntity > mEntityFilters = QList< QgsStyle::StyleEntity >() <<
QgsStyle::SymbolEntity;
377 bool mSymbolTypeFilterEnabled =
false;
384 #endif //QGSSTYLEMODEL_H A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
QgsStyle * style()
Returns the style managed by the model.
Abstract base class for all rendered symbols.
Layer type (for label settings entities)
StyleEntity
Enum for Entities involved in a style.
SymbolType
Type of the symbol.
QString filterString() const
Returns the current filter string, if set.
A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle ...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Whether entity is flagged as a favorite.
Symbol type (for symbol entities)