Class: QgsStyleProxyModel

class qgis.core.QgsStyleProxyModel

Bases: PyQt5.QtCore.QSortFilterProxyModel

A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle database.

See also

QgsStyleModel

New in version 3.4.

QgsStyleProxyModel(style: QgsStyle, parent: QObject = None) Constructor for QgsStyleProxyModel, for the specified style and parent object.

The style object must exist for the lifetime of this model.

QgsStyleProxyModel(model: QgsStyleModel, parent: QObject = None) Constructor for QgsStyleProxyModel, using the specified source model and parent object.

The source model object must exist for the lifetime of this model.

QgsStyleProxyModel(model: QgsCombinedStyleModel, parent: QObject = None) Constructor for QgsStyleProxyModel, using the specified source combined model and parent object.

The source model object must exist for the lifetime of this model.

Note

This is only available on builds based on Qt 5.13 or later.

New in version 3.26:

Methods

addDesiredIconSize

Adds an additional icon size to generate for Qt.DecorationRole data.

addTargetScreenProperties

Adds additional target screen properties to use when generating icons for Qt.DecorationRole data.

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

connectNotify

createIndex

customEvent

decodeData

disconnectNotify

encodeData

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

entityFilter

Returns the style entity type filter.

entityFilterEnabled

Returns True if filtering by entity type is enabled.

favoritesOnly

Returns True if the model is showing only favorited entities.

filterAcceptsColumn

filterAcceptsRow

param source_row:

filterString

Returns the current filter string, if set.

invalidateFilter

isSignalConnected

layerType

Returns the layer type filter, or Qgis.GeometryType.Unknown if no layer type filter is present.

lessThan

param left:

persistentIndexList

receivers

resetInternalData

sender

senderSignalIndex

setEntityFilter

Sets the style entity type filter.

setEntityFilterEnabled

Sets whether filtering by entity type is enabled.

setFavoritesOnly

Sets whether the model should show only favorited entities.

setFilterString

Sets a filter string, such that only symbol entities with names matching the specified string will be shown.

setLayerType

Sets the layer type filter.

setSmartGroupId

Sets a smart group id to filter style entities by.

setSymbolType

Sets the symbol type filter.

setSymbolTypeFilterEnabled

Sets whether filtering by symbol type is enabled.

setTagId

Sets a tag id to filter style entities by.

setTagString

Sets a tag to filter style entities by.

smartGroupId

Returns the smart group id used to filter style entities by.

symbolType

Returns the symbol type filter.

symbolTypeFilterEnabled

Returns True if filtering by symbol type is enabled.

tagId

Returns the tag id used to filter style entities by.

tagString

Returns the tag string used to filter style entities by.

timerEvent

addDesiredIconSize(self, size: QSize)

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.

Parameters:

size (QSize) –

addTargetScreenProperties(self, properties: QgsScreenProperties)

Adds additional target screen properties to 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.

New in version 3.32.

Parameters:

properties (QgsScreenProperties) –

beginInsertColumns(self, QModelIndex, int, int)
beginInsertRows(self, QModelIndex, int, int)
beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) bool
beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) bool
beginRemoveColumns(self, QModelIndex, int, int)
beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createIndex(self, int, int, object: object = 0) QModelIndex
customEvent(self, QEvent)
decodeData(self, int, int, QModelIndex, QDataStream) bool
disconnectNotify(self, QMetaMethod)
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
entityFilter(self) QgsStyle.StyleEntity

Returns the style entity type filter.

Note

This filter is only active if entityFilterEnabled() is True.

Return type:

QgsStyle.StyleEntity

entityFilterEnabled(self) bool

Returns True if filtering by entity type is enabled.

See also

entityFilter()

Return type:

bool

favoritesOnly(self) bool

Returns True if the model is showing only favorited entities.

Return type:

bool

filterAcceptsColumn(self, int, QModelIndex) bool
filterAcceptsRow(self, source_row: int, source_parent: QModelIndex) bool
Parameters:
  • source_row (int) –

  • source_parent (QModelIndex) –

Return type:

bool

filterString(self) str

Returns the current filter string, if set.

Return type:

str

invalidateFilter(self)
isSignalConnected(self, QMetaMethod) bool
layerType(self) Qgis.GeometryType

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

setLayerType()

Return type:

Qgis.GeometryType

lessThan(self, left: QModelIndex, right: QModelIndex) bool
Parameters:
  • left (QModelIndex) –

  • right (QModelIndex) –

Return type:

bool

persistentIndexList(self) List[QModelIndex]
receivers(self, PYQT_SIGNAL) int
resetInternalData(self)
sender(self) QObject
senderSignalIndex(self) int
setEntityFilter(self, filter: QgsStyle.StyleEntity)

Sets the style entity type filter.

Note

This filter is only active if entityFilterEnabled() is True.

See also

entityFilter()

Parameters:

filter (QgsStyle.StyleEntity) –

setEntityFilterEnabled(self, enabled: bool)

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.

Parameters:

enabled (bool) –

setFavoritesOnly(self, favoritesOnly: bool)

Sets whether the model should show only favorited entities.

Parameters:

favoritesOnly (bool) –

setFilterString(self, filter: str)

Sets a filter string, such that only symbol entities with names matching the specified string will be shown.

See also

filterString()

Parameters:

filter (str) –

setLayerType(self, type: Qgis.GeometryType)

Sets the layer type filter. Set type to Qgis.GeometryType.Unknown if no layer type filter is desired.

See also

layerType()

Parameters:

type (Qgis.GeometryType) –

setSmartGroupId(self, id: int)

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.

Note

This method has no effect for models created using QgsCombinedStyleModel source models.

See also

smartGroupId()

Parameters:

id (int) –

setSymbolType(self, type: Qgis.SymbolType)

Sets the symbol type filter.

Note

This filter is only active if Qgis.SymbolTypeFilterEnabled() is True.

See also

Qgis.SymbolType

Parameters:

type (Qgis.SymbolType) –

setSymbolTypeFilterEnabled(self, enabled: bool)

Sets whether filtering by symbol type is enabled.

If enabled is False, then the value of Qgis.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

setSymbolType()

Parameters:

enabled (bool) –

setTagId(self, id: int)

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.

Note

This method has no effect for models created using QgsCombinedStyleModel source models. Use setTagString() instead.

See also

tagId()

Parameters:

id (int) –

setTagString(self, tag: str)

Sets a tag to filter style entities by. Only entities with the given tag will be shown in the model.

Set tag to an empty string to disable tag filtering.

See also

tagString()

New in version 3.26.

Parameters:

tag (str) –

smartGroupId(self) int

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 QgsCombinedStyleModel source models.

Return type:

int

symbolType(self) Qgis.SymbolType

Returns the symbol type filter.

Note

This filter is only active if Qgis.SymbolTypeFilterEnabled() is True, and has no effect on non-symbol entities (i.e. color ramps).

See also

setSymbolType()

Return type:

Qgis.SymbolType

symbolTypeFilterEnabled(self) bool

Returns True if filtering by symbol type is enabled.

See also

Qgis.SymbolType

Return type:

bool

tagId(self) int

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 QgsCombinedStyleModel source models. Use tagString() instead.

See also

setTagId()

Return type:

int

tagString(self) str

Returns the tag string used to filter style entities by.

If returned value is empty, then no tag filtering is being conducted.

See also

setTagString()

New in version 3.26.

Return type:

str

timerEvent(self, QTimerEvent)