Class: QgsStyleProxyModel¶
A QSortFilterProxyModel subclass for showing filtered symbol and color
ramps entries from a QgsStyle database.
See also
Added in version 3.4.
Class Hierarchy¶
Base classes¶
Methods
Adds an additional icon size to generate for Qt.DecorationRole data.  | 
|
Adds additional target screen properties to use when generating icons for Qt.DecorationRole data.  | 
|
Returns the style entity type filter.  | 
|
Returns   | 
|
Returns   | 
|
Returns the current filter string, if set.  | 
|
Returns the layer type filter, or   | 
|
Sets the style entity type filter.  | 
|
Sets whether filtering by entity type is enabled.  | 
|
Sets whether the model should show only favorited entities.  | 
|
Sets a filter string, such that only symbol entities with names matching the specified string will be shown.  | 
|
Sets the layer type filter.  | 
|
Sets a smart group id to filter style entities by.  | 
|
Sets the symbol type filter.  | 
|
Sets whether filtering by symbol type is enabled.  | 
|
Sets a tag id to filter style entities by.  | 
|
Sets a tag to filter style entities by.  | 
|
Returns the smart group id used to filter style entities by.  | 
|
Returns the symbol type filter.  | 
|
Returns   | 
|
Returns the tag id used to filter style entities by.  | 
|
Returns the tag string used to filter style entities by.  | 
- class qgis.core.QgsStyleProxyModel[source]¶
 Bases:
QSortFilterProxyModel- __init__(style: QgsStyle | None, parent: QObject | None = None)
 Constructor for QgsStyleProxyModel, for the specified
styleandparentobject.The
styleobject must exist for the lifetime of this model.- Parameters:
 style (Optional[QgsStyle])
parent (Optional[QObject] = None)
- __init__(model: QgsStyleModel | None, parent: QObject | None = None)
 Constructor for QgsStyleProxyModel, using the specified source
modelandparentobject.The source
modelobject must exist for the lifetime of this model.- Parameters:
 model (Optional[QgsStyleModel])
parent (Optional[QObject] = None)
- __init__(model: QgsCombinedStyleModel | None, parent: QObject | None = None)
 Constructor for QgsStyleProxyModel, using the specified source combined
modelandparentobject.The source
modelobject must exist for the lifetime of this model.Note
This is only available on builds based on Qt 5.13 or later.
Added in version 3.26.
- Parameters:
 model (Optional[QgsCombinedStyleModel])
parent (Optional[QObject] = None)
- addDesiredIconSize(self, size: QSize)[source]¶
 Adds an additional icon
sizeto 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.
- Parameters:
 size (QSize)
- addTargetScreenProperties(self, properties: QgsScreenProperties)[source]¶
 Adds additional target screen
propertiesto use when generating icons for Qt.DecorationRole data.This allows style icons to be generated at an icon device pixel ratio and DPI which corresponds exactly to the view’s screen properties in which this model is used.
Added in version 3.32.
- Parameters:
 properties (QgsScreenProperties)
- entityFilter(self) QgsStyle.StyleEntity[source]¶
 Returns the style entity type filter.
Note
This filter is only active if
entityFilterEnabled()isTrue.See also
- Return type:
 
- entityFilterEnabled(self) bool[source]¶
 Returns
Trueif filtering by entity type is enabled.See also
See also
- Return type:
 bool
- favoritesOnly(self) bool[source]¶
 Returns
Trueif the model is showing only favorited entities.See also
- Return type:
 bool
- filterString(self) str[source]¶
 Returns the current filter string, if set.
See also
- Return type:
 str
- layerType(self) Qgis.GeometryType[source]¶
 Returns the layer type filter, or
Qgis.GeometryType.Unknown if no layer type filter is present.This setting has an effect on label settings entities and 3d symbols only.
See also
- Return type:
 
- setEntityFilter(self, filter: QgsStyle.StyleEntity)[source]¶
 Sets the style entity type
filter.Note
This filter is only active if
entityFilterEnabled()isTrue.See also
- Parameters:
 filter (QgsStyle.StyleEntity)
- setEntityFilterEnabled(self, enabled: bool)[source]¶
 Sets whether filtering by entity type is
enabled.If
enabledisFalse, then the value ofentityFilter()will have no effect on the model filtering.See also
See also
- Parameters:
 enabled (bool)
- setFavoritesOnly(self, favoritesOnly: bool)[source]¶
 Sets whether the model should show only favorited entities.
See also
- Parameters:
 favoritesOnly (bool)
- setFilterString(self, filter: str | None)[source]¶
 Sets a
filterstring, such that only symbol entities with names matching the specified string will be shown.See also
- Parameters:
 filter (Optional[str])
- setLayerType(self, type: Qgis.GeometryType)[source]¶
 Sets the layer
typefilter. SettypetoQgis.GeometryType.Unknown if no layer type filter is desired.See also
- Parameters:
 type (Qgis.GeometryType)
- setSmartGroupId(self, id: int)[source]¶
 Sets a smart group
idto filter style entities by. Only entities within the given smart group will be shown in the model.Set
idto -1 to disable smart group filtering.Note
This method has no effect for models created using
QgsCombinedStyleModelsource models.See also
- Parameters:
 id (int)
- setSymbolType(self, type: Qgis.SymbolType)[source]¶
 Sets the symbol
typefilter.Note
This filter is only active if
Qgis.SymbolTypeFilterEnabled() isTrue.See also
Qgis.SymbolType
- Parameters:
 type (Qgis.SymbolType)
- setSymbolTypeFilterEnabled(self, enabled: bool)[source]¶
 Sets whether filtering by symbol type is
enabled.If
enabledisFalse, then the value ofQgis.SymbolType() will have no effect on the model filtering. This has no effect on non-symbol entities (i.e. color ramps).See also
Qgis.SymbolTypeFilterEnabled
See also
- Parameters:
 enabled (bool)
- setTagId(self, id: int)[source]¶
 Sets a tag
idto filter style entities by. Only entities with the given tag will be shown in the model.Set
idto -1 to disable tag filtering.Note
This method has no effect for models created using
QgsCombinedStyleModelsource models. UsesetTagString()instead.See also
- Parameters:
 id (int)
- setTagString(self, tag: str | None)[source]¶
 Sets a
tagto filter style entities by. Only entities with the given tag will be shown in the model.Set
tagto an empty string to disable tag filtering.See also
Added in version 3.26.
- Parameters:
 tag (Optional[str])
- smartGroupId(self) int[source]¶
 Returns the smart group id used to filter style entities by.
If returned value is -1, then no smart group filtering is being conducted.
Note
This method has no effect for models created using
QgsCombinedStyleModelsource models.See also
- Return type:
 int
- symbolType(self) Qgis.SymbolType[source]¶
 Returns the symbol type filter.
Note
This filter is only active if
Qgis.SymbolTypeFilterEnabled() isTrue, and has no effect on non-symbol entities (i.e. color ramps).See also
- Return type:
 
- symbolTypeFilterEnabled(self) bool[source]¶
 Returns
Trueif filtering by symbol type is enabled.See also
See also
Qgis.SymbolType
- Return type:
 bool
- tagId(self) int[source]¶
 Returns the tag id used to filter style entities by.
If returned value is -1, then no tag filtering is being conducted.
Note
This method has no effect for models created using
QgsCombinedStyleModelsource models. UsetagString()instead.See also
- Return type:
 int