QgsStyleProxyModel class
A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle database.
Contents
Constructors, destructors, conversion operators
- QgsStyleProxyModel(QgsStyle* style, QObject* parent = nullptr) explicit
- Constructor for QgsStyleProxyModel, for the specified style and parent object.
Public functions
- void addDesiredIconSize(QSize size)
- Adds an additional icon size to generate for Qt::DecorationRole data.
-
auto entityFilter() const -> QgsStyle::
StyleEntity - Returns the style entity type filter.
- auto entityFilterEnabled() const -> bool
- Returns true if filtering by entity type is enabled.
- auto favoritesOnly() const -> bool
- Returns true if the model is showing only favorited entities.
- auto filterString() const -> QString
- Returns the current filter string, if set.
-
void setEntityFilter(QgsStyle::
StyleEntity filter) - Sets the style entity type filter.
- void setEntityFilterEnabled(bool enabled)
- Sets whether filtering by entity type is enabled.
- void setFavoritesOnly(bool favoritesOnly)
- Sets whether the model should show only favorited entities.
- void setSmartGroupId(int id)
- Sets a smart group id to filter style entities by.
-
void setSymbolType(QgsSymbol::
SymbolType type) - Sets the symbol type filter.
- void setSymbolTypeFilterEnabled(bool enabled)
- Sets whether filtering by symbol type is enabled.
- void setTagId(int id)
- Sets a tag id to filter style entities by.
- auto smartGroupId() const -> int
- Returns the smart group id used to filter style entities by.
-
auto symbolType() const -> QgsSymbol::
SymbolType - Returns the symbol type filter.
- auto symbolTypeFilterEnabled() const -> bool
- Returns true if filtering by symbol type is enabled.
- auto tagId() const -> int
- Returns the tag id used to filter style entities by.
Public slots
- void setFilterString(const QString& filter)
- Sets a filter string, such that only symbol entities with names matching the specified string will be shown.
Function documentation
QgsStyleProxyModel:: QgsStyleProxyModel(QgsStyle* style,
QObject* parent = nullptr) explicit
Constructor for QgsStyleProxyModel, for the specified style and parent object.
The style object must exist for the lifetime of this model.
void QgsStyleProxyModel:: addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
This allows style icons to be generated at an icon size which corresponds exactly to the view's icon size in which this model is used.
QgsStyle:: StyleEntity QgsStyleProxyModel:: entityFilter() const
Returns the style entity type filter.
bool QgsStyleProxyModel:: entityFilterEnabled() const
Returns true if filtering by entity type is enabled.
bool QgsStyleProxyModel:: favoritesOnly() const
Returns true if the model is showing only favorited entities.
QString QgsStyleProxyModel:: filterString() const
Returns the current filter string, if set.
void QgsStyleProxyModel:: setEntityFilter(QgsStyle:: StyleEntity filter)
Sets the style entity type filter.
void QgsStyleProxyModel:: setEntityFilterEnabled(bool enabled)
Sets whether filtering by entity type is enabled.
If enabled is false, then the value of entityFilter() will have no effect on the model filtering.
void QgsStyleProxyModel:: setFavoritesOnly(bool favoritesOnly)
Sets whether the model should show only favorited entities.
void QgsStyleProxyModel:: setSmartGroupId(int id)
Sets a smart group id to filter style entities by.
Only entities within the given smart group will be shown in the model.
Set id to -1 to disable smart group filtering.
void QgsStyleProxyModel:: setSymbolType(QgsSymbol:: SymbolType type)
Sets the symbol type filter.
void QgsStyleProxyModel:: setSymbolTypeFilterEnabled(bool enabled)
Sets whether filtering by symbol type is enabled.
If enabled is false, then the value of symbolType() will have no effect on the model filtering. This has no effect on non-symbol entities (i.e. color ramps).
void QgsStyleProxyModel:: setTagId(int id)
Sets a tag id to filter style entities by.
Only entities with the given tag will be shown in the model.
Set id to -1 to disable tag filtering.
int QgsStyleProxyModel:: smartGroupId() const
Returns the smart group id used to filter style entities by.
If returned value is -1, then no smart group filtering is being conducted.
QgsSymbol:: SymbolType QgsStyleProxyModel:: symbolType() const
Returns the symbol type filter.
bool QgsStyleProxyModel:: symbolTypeFilterEnabled() const
Returns true if filtering by symbol type is enabled.
int QgsStyleProxyModel:: tagId() const
Returns the tag id used to filter style entities by.
If returned value is -1, then no tag filtering is being conducted.
void QgsStyleProxyModel:: setFilterString(const QString& filter) public slot
Sets a filter string, such that only symbol entities with names matching the specified string will be shown.