Class: QgsProjectStyleDatabaseModel

List model representing the style databases associated with a QgsProject.

Added in version 3.26.

Class Hierarchy

Inheritance diagram of qgis.core.QgsProjectStyleDatabaseModel

Base classes

QAbstractListModel

QAbstractItemModel

QObject

class qgis.core.QgsProjectStyleDatabaseModel[source]

Bases: QAbstractListModel

__init__(settings: QgsProjectStyleSettings | None, parent: QObject | None = None)

Constructor for QgsProjectStyleDatabaseModel, showing the styles from the specified settings.

Parameters:
class CustomRole(*values)

Bases: IntEnum

Custom model roles.

Note

Prior to QGIS 3.36 this was available as QgsProjectStyleDatabaseModel.Role

Added in version 3.36.

  • Style: Style object

    Available as QgsProjectStyleDatabaseModel.StyleRole in older QGIS releases.

  • Path: Style path

    Available as QgsProjectStyleDatabaseModel.PathRole in older QGIS releases.

Role

alias of CustomRole

indexFromStyle(self, style: QgsStyle | None) QModelIndex[source]

Returns the model index corresponding to a style.

See also

styleFromIndex()

Parameters:

style (Optional[QgsStyle])

Return type:

QModelIndex

setShowDefaultStyle(self, show: bool)[source]

Sets whether the default style should also be included in the model.

Parameters:

show (bool)

showDefaultStyle(self) bool[source]

Returns True if the model includes the default style.

Return type:

bool

styleFromIndex(self, index: QModelIndex) QgsStyle | None[source]

Returns the style at the corresponding index.

See also

indexFromStyle()

Parameters:

index (QModelIndex)

Return type:

Optional[QgsStyle]