Class: QgsStyle

class qgis.core.QgsStyle(parent: QObject = None)

Bases: PyQt5.QtCore.QObject

Constructor for QgsStyle, with the specified parent object.

Enums

TextFormatContext

Bases: enum.IntEnum

Methods

addColorRamp

Adds a color ramp to the style.

addEntity

Adds an entity to the style, with the specified name.

addFavorite

Adds the specified symbol to favorites

addLabelSettings

Adds label settings with the specified name to the style.

addLegendPatchShape

Adds a legend patch shape with the specified name to the style.

addSmartgroup

Adds a new smartgroup to the database and returns the id.

addSymbol

Adds a symbol to style and takes symbol's ownership

addSymbol3D

Adds a 3d symbol with the specified name to the style.

addTag

Adds a new tag and returns the tag's id

addTextFormat

Adds a text format with the specified name to the style.

allNames

Returns a list of the names of all existing entities of the specified type.

childEvent

clear

Removes all contents of the style

colorRamp

Returns a new copy of the specified color ramp.

colorRampCount

Returns count of color ramps

colorRampNames

Returns a list of names of color ramps

colorRampRef

Returns a const pointer to a symbol (doesn't create new instance)

colorrampId

Returns the id in the style database for the given colorramp name returns 0 if not found

connectNotify

createDatabase

Creates an on-disk database

createMemoryDatabase

Creates a temporary memory database

createTables

Creates tables structure for new database

customEvent

defaultPatch

Returns the default legend patch shape for the given symbol type.

defaultPatchAsQPolygonF

Returns the default patch geometry for the given symbol type and size as a set of QPolygonF objects (parts and rings).

defaultStyle

Returns the default application-wide style.

defaultTextFormat

Returns the default text format to use for new text based objects in the specified context.

defaultTextFormatForProject

Returns the default text format to use for new text based objects for the specified project, in the specified context.

detagSymbol

Detags the symbol with the given list

disconnectNotify

entityId

Returns the id in the style database for the given name of the specified entity type.

errorString

Returns the last error from a load() operation.

exportXml

Exports the style as a XML file

fileName

Returns the current file name of the style database.

findSymbols

Returns the names of the symbols which have a matching 'substring' in its definition

importXml

Imports the symbols and colorramps into the default style database from the given XML file

isFavorite

Returns True if the symbol with matching type and name is marked as a favorite.

isInitialized

Returns True if the style is initialized and ready for use.

isReadOnly

Returns True if the style is considered a read-only library.

isSignalConnected

isXmlStyleFile

Tests if the file at path is a QGIS style XML file.

labelSettings

Returns the label settings with the specified name.

labelSettingsCount

Returns count of label settings in the style.

labelSettingsId

Returns the ID in the style database for the given label settings by name.

labelSettingsLayerType

Returns the layer geometry type corresponding to the label settings with the specified name, or Qgis.GeometryType.Unknown if matching label settings are not present.

labelSettingsNames

Returns a list of names of label settings in the style.

legendPatchShape

Returns the legend patch shape with the specified name.

legendPatchShapeNames

Returns a list of names of legend patch shapes in the style.

legendPatchShapeSymbolType

Returns the symbol type corresponding to the legend patch shape with the specified name, or QgsSymbol.Hybrid if a matching legend patch shape is not present.

legendPatchShapesCount

Returns count of legend patch shapes in the style.

load

Loads a file into the style

name

Returns the name of the style.

previewSymbolForPatchShape

Returns a symbol to use for rendering preview icons for a patch shape.

receivers

remove

Removes the specified entity from the database.

removeColorRamp

Removes color ramp from style (and delete it)

removeEntityByName

Removes the entry of the specified type with matching name from the database.

removeFavorite

Removes the specified symbol from favorites

removeLabelSettings

Removes label settings from the style.

removeSymbol

Removes symbol from style (and delete it)

removeTextFormat

Removes a text format from the style.

rename

Renames the given entity with the specified id

renameColorRamp

Changes ramp's name

renameEntity

Renames an entity of the specified type from oldName to newName.

renameLabelSettings

Changes a label setting's name.

renameLegendPatchShape

Changes a legend patch shape's name.

renameSymbol

Renames a symbol from oldName to newName.

renameSymbol3D

Changes a 3d symbol's name.

renameTextFormat

Changes a text format's name.

save

Saves style into a file.

saveColorRamp

Adds the colorramp to the database.

saveLabelSettings

Adds label settings to the database.

saveLegendPatchShape

Adds a legend patch shape to the database.

saveSymbol

Adds the symbol to the database with tags.

saveSymbol3D

Adds a 3d symbol to the database.

saveTextFormat

Adds a text format to the database.

sender

senderSignalIndex

setFileName

Sets the current file name of the style database.

setName

Sets the name of the style.

setReadOnly

Sets whether the style is considered a read-only library.

smartgroup

Returns the QgsSmartConditionMap for the given id

smartgroupId

Returns the database id for the given smartgroup name

smartgroupNames

Returns the smart groups list

smartgroupOperator

Returns the operator for the smartgroup.

smartgroupsListMap

Returns the smart groups map with id as key and name as value

symbol

Returns a NEW copy of symbol

symbol3D

Returns a new copy of the 3D symbol with the specified name.

symbol3DCompatibleGeometryTypes

Returns the list of the vector layer geometry types which are compatible with the 3D symbol with the specified name, or an empty list if a matching 3d symbol is not present.

symbol3DCount

Returns count of 3D symbols in the style.

symbol3DNames

Returns a list of names of 3d symbols in the style.

symbolCount

Returns count of symbols in style

symbolHasTag

Returns whether a given tag is associated with the symbol

symbolId

Returns the id in the style database for the given symbol name returns 0 if not found

symbolNames

Returns a list of names of symbols

symbolRef

Returns a const pointer to a symbol (doesn't create new instance)

symbolsOfFavorite

Returns the symbol names which are flagged as favorite

symbolsOfSmartgroup

Returns the symbols for the smartgroup

symbolsWithTag

Returns the symbol names with which have the given tag

tag

Returns the tag name for the given id

tagId

Returns the database id for the given tag name

tagSymbol

Tags the symbol with the tags in the list

tags

Returns a list of all tags in the style database

tagsOfSymbol

Returns the tags associated with the symbol

textFormat

Returns the text format with the specified name.

textFormatCount

Returns count of text formats in the style.

textFormatId

Returns the ID in the style database for the given text format by name.

textFormatNames

Returns a list of names of text formats in the style.

timerEvent

Signals

aboutToBeDestroyed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

entityAdded

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

entityChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

entityRemoved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

entityRenamed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

entityTagsChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

favoritedChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

groupsModified

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

initialized

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

labelSettingsAdded

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

labelSettingsChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

labelSettingsRemoved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

labelSettingsRenamed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

rampAdded

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

rampChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

rampRemoved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

rampRenamed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

rebuildIconPreviews

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

symbolChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

symbolRemoved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

symbolRenamed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

symbolSaved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

textFormatAdded

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

textFormatChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

textFormatRemoved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

textFormatRenamed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

Attributes

ColorrampEntity

LabelSettingsEntity

LegendPatchShapeEntity

SmartgroupEntity

Symbol3DEntity

SymbolEntity

TagEntity

TextFormatEntity

ColorrampEntity = 2
LabelSettingsEntity = 5
LegendPatchShapeEntity = 6
SmartgroupEntity = 3
class StyleEntity

Bases: int

Symbol3DEntity = 7
SymbolEntity = 0
TagEntity = 1
class TextFormatContext(value)

Bases: enum.IntEnum

Text format context.

New in version 3.20.

  • Labeling: Text format used in labeling

Labeling = 0
TextFormatEntity = 4
aboutToBeDestroyed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

addColorRamp(self, name: str, colorRamp: QgsColorRamp, update: bool = False) bool

Adds a color ramp to the style. Calling this method takes the ramp’s ownership.

Note

Adding a color ramp with the name of existing one replaces it.

Parameters:
  • name (str) – is the name of the color ramp being added or updated

  • colorRamp (QgsColorRamp) – is the color ramp. Ownership is transferred.

  • update (bool = False) – set to True when the style database has to be updated, by default it is False

Return type:

bool

Returns:

success status of the operation

addEntity(self, name: str, entity: QgsStyleEntityInterface, update: bool = False) bool

Adds an entity to the style, with the specified name. Ownership is not transferred.

If update is True then the style database is updated automatically as a result.

Returns True if the add operation was successful.

Note

Adding an entity with the name of existing one replaces the existing one automatically.

New in version 3.10.

Parameters:
Return type:

bool

addFavorite(self, type: QgsStyle.StyleEntity, name: str) bool

Adds the specified symbol to favorites

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity of ColorrampEntity

  • name (str) – is the name of the symbol or coloramp whose is to be added to favorites

Return type:

bool

Returns:

returns the success state as bool

addLabelSettings(self, name: str, settings: QgsPalLayerSettings, update: bool = False) bool

Adds label settings with the specified name to the style.

If update is set to True, the style database will be automatically updated with the new text format.

Returns True if the operation was successful.

Note

Adding label settings with the name of existing ones replaces them.

New in version 3.10.

Parameters:
Return type:

bool

addLegendPatchShape(self, name: str, shape: QgsLegendPatchShape, update: bool = False) bool

Adds a legend patch shape with the specified name to the style.

If update is set to True, the style database will be automatically updated with the new legend patch shape.

Returns True if the operation was successful.

Note

Adding legend patch shapes with the name of existing ones replaces them.

New in version 3.14.

Parameters:
Return type:

bool

addSmartgroup(self, name: str, op: str, matchTag: Iterable[str], noMatchTag: Iterable[str], matchName: Iterable[str], noMatchName: Iterable[str]) int

Adds a new smartgroup to the database and returns the id.

Parameters:
  • name (str) – is the name of the new Smart Group to be added

  • op (str) – is the operator between the conditions; AND/OR as QString

  • matchTag (Iterable[str]) – list of strings to match within tags

  • noMatchTag (Iterable[str]) – list of strings to exclude matches from tags

  • matchName (Iterable[str]) – list of string to match within names

  • noMatchName (Iterable[str]) – list of strings to exclude matches from names

New in version 3.4.

Return type:

int

addSymbol(self, name: str, symbol: QgsSymbol, update: bool = False) bool

Adds a symbol to style and takes symbol’s ownership

Note

Adding a symbol with the name of existing one replaces it.

Parameters:
  • name (str) – is the name of the symbol being added or updated

  • symbol (QgsSymbol) – is the Vector symbol

  • update (bool = False) – set to True when the style database has to be updated, by default it is False

Return type:

bool

Returns:

success status of the operation

addSymbol3D(self, name: str, symbol: QgsAbstract3DSymbol, update: bool = False) bool

Adds a 3d symbol with the specified name to the style. Ownership of symbol is transferred.

If update is set to True, the style database will be automatically updated with the new legend patch shape.

Returns True if the operation was successful.

Note

Adding 3d symbols with the name of existing ones replaces them.

New in version 3.16.

Parameters:
Return type:

bool

addTag(self, tagName: str) int

Adds a new tag and returns the tag’s id

Parameters:

tagName (str) – the name of the new tag to be created

Return type:

int

Returns:

returns an int, which is the database id of the new tag created, 0 if the tag couldn’t be created

addTextFormat(self, name: str, format: QgsTextFormat, update: bool = False) bool

Adds a text format with the specified name to the style.

If update is set to True, the style database will be automatically updated with the new text format.

Returns True if the operation was successful.

Note

Adding a text format with the name of existing one replaces it.

New in version 3.10.

Parameters:
  • name (str) –

  • format (QgsTextFormat) –

  • update (bool = False) –

Return type:

bool

allNames(self, type: QgsStyle.StyleEntity) List[str]

Returns a list of the names of all existing entities of the specified type.

New in version 3.10.

Parameters:

type (QgsStyle.StyleEntity) –

Return type:

List[str]

childEvent(self, QChildEvent)
clear(self)

Removes all contents of the style

colorRamp(self, name: str) QgsColorRamp

Returns a new copy of the specified color ramp. The caller takes responsibility for deleting the returned object.

Parameters:

name (str) –

Return type:

QgsColorRamp

colorRampCount(self) int

Returns count of color ramps

Return type:

int

colorRampNames(self) List[str]

Returns a list of names of color ramps

Return type:

List[str]

colorRampRef(self, name: str) QgsColorRamp

Returns a const pointer to a symbol (doesn’t create new instance)

Parameters:

name (str) –

Return type:

QgsColorRamp

colorrampId(self, name: str) int

Returns the id in the style database for the given colorramp name returns 0 if not found

Parameters:

name (str) –

Return type:

int

connectNotify(self, QMetaMethod)
createDatabase(self, filename: str) bool

Creates an on-disk database

This function creates a new on-disk permanent style database.

Return type:

bool

Returns:

returns the success state of the database creation

New in version 3.0.

Parameters:

filename (str) –

createMemoryDatabase(self) bool

Creates a temporary memory database

This function is used to create a temporary style database in case a permanent on-disk database is not needed.

Return type:

bool

Returns:

returns the success state of the temporary memory database creation

See also

createDatabase()

New in version 3.0.

createTables(self)

Creates tables structure for new database

This function is used to create the tables structure in a newly-created database.

See also

createDatabase()

New in version 3.0.

customEvent(self, QEvent)
defaultPatch(self, type: Qgis.SymbolType, size: QSizeF) QgsLegendPatchShape

Returns the default legend patch shape for the given symbol type.

New in version 3.14.

Parameters:
Return type:

QgsLegendPatchShape

defaultPatchAsQPolygonF(self, type: Qgis.SymbolType, size: QSizeF) object

Returns the default patch geometry for the given symbol type and size as a set of QPolygonF objects (parts and rings).

See also

defaultPatch()

New in version 3.14.

Parameters:
Return type:

object

defaultStyle(initialize: bool = True) QgsStyle

Returns the default application-wide style.

Since QGIS 3.36, the initialize argument can be set to False to temporarily defer the actual loading of the style’s objects until they are first requested. This lazy-initialization can substantially improve application startup times, especially for standalone applications which do not utilize styles.

Parameters:

initialize (bool = True) –

Return type:

QgsStyle

defaultTextFormat(self, context: QgsStyle.TextFormatContext = QgsStyle.TextFormatContext.Labeling) QgsTextFormat

Returns the default text format to use for new text based objects in the specified context.

New in version 3.20.

Parameters:

context (QgsStyle.TextFormatContext = QgsStyle.TextFormatContext.Labeling) –

Return type:

QgsTextFormat

defaultTextFormatForProject(project: QgsProject, context: QgsStyle.TextFormatContext = QgsStyle.TextFormatContext.Labeling) QgsTextFormat

Returns the default text format to use for new text based objects for the specified project, in the specified context.

New in version 3.26.

Parameters:
  • project (QgsProject) –

  • context (QgsStyle.TextFormatContext = QgsStyle.TextFormatContext.Labeling) –

Return type:

QgsTextFormat

detagSymbol(self, type: QgsStyle.StyleEntity, symbol: str, tags: Iterable[str]) bool

Detags the symbol with the given list

Removes the given tags for the specified symbol or colorramp

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity or ColorrampEntity

  • symbol (str) – is the name of the symbol or colorramp

  • tags (Iterable[str]) – is the list of tags that are to be removed as QStringList

Returns:

returns the success state of the operation

detagSymbol(self, type: QgsStyle.StyleEntity, symbol: str) -> bool Clears the symbol from all attached tags

Removes all tags for the specified symbol or colorramp

Parameters:
  • type – is either SymbolEntity or ColorrampEntity

  • symbol – is the name of the symbol or colorramp

Return type:

bool

Returns:

returns the success state of the operation

disconnectNotify(self, QMetaMethod)
entityAdded

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

entityChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

entityId(self, type: QgsStyle.StyleEntity, name: str) int

Returns the id in the style database for the given name of the specified entity type. Returns 0 if not found.

Parameters:
Return type:

int

entityRemoved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

entityRenamed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

entityTagsChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

errorString(self) str

Returns the last error from a load() operation.

See also

load()

Return type:

str

exportXml(self, filename: str) bool

Exports the style as a XML file

Parameters:

filename (str) –

Return type:

bool

favoritedChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

fileName(self) str

Returns the current file name of the style database.

The filename will always represent the actual source of the style - e.g. the .db file for styles associated with a database, or the original source .xml file for styles directly loaded from a .xml export.

See also

setFileName()

Return type:

str

findSymbols(self, type: QgsStyle.StyleEntity, qword: str) List[str]

Returns the names of the symbols which have a matching ‘substring’ in its definition

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity or ColorrampEntity

  • qword (str) – is the query string to search the symbols or colorramps.

Return type:

List[str]

Returns:

A QStringList of the matched symbols or colorramps

groupsModified

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

importXml(self, filename: str) bool

Imports the symbols and colorramps into the default style database from the given XML file

Parameters:

filename (str) –

Return type:

bool

initialized

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

isFavorite(self, type: QgsStyle.StyleEntity, name: str) bool

Returns True if the symbol with matching type and name is marked as a favorite.

New in version 3.10.

Parameters:
Return type:

bool

isInitialized(self) bool

Returns True if the style is initialized and ready for use.

Most instances of QgsStyle will already be initialized. However, if the style is the QgsStyle.defaultStyle() object it may have been created using lazy initialization and will return False until it is initialized().

New in version 3.36.

Return type:

bool

isReadOnly(self) bool

Returns True if the style is considered a read-only library.

Note

This flag is used to control GUI operations, and does not prevent calling functions which mutate the style directly via the API.

See also

setReadOnly()

New in version 3.26.

Return type:

bool

isSignalConnected(self, QMetaMethod) bool
isXmlStyleFile(path: str) bool

Tests if the file at path is a QGIS style XML file.

This method samples only the first line in the file, so is safe to call on large xml files.

New in version 3.6.

Parameters:

path (str) –

Return type:

bool

labelSettings(self, name: str) QgsPalLayerSettings

Returns the label settings with the specified name.

New in version 3.10.

Parameters:

name (str) –

Return type:

QgsPalLayerSettings

labelSettingsAdded

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

labelSettingsChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

labelSettingsCount(self) int

Returns count of label settings in the style.

New in version 3.10.

Return type:

int

labelSettingsId(self, name: str) int

Returns the ID in the style database for the given label settings by name. Returns 0 if the label settings were not found.

New in version 3.10.

Parameters:

name (str) –

Return type:

int

labelSettingsLayerType(self, name: str) Qgis.GeometryType

Returns the layer geometry type corresponding to the label settings with the specified name, or Qgis.GeometryType.Unknown if matching label settings are not present.

New in version 3.10.

Parameters:

name (str) –

Return type:

Qgis.GeometryType

labelSettingsNames(self) List[str]

Returns a list of names of label settings in the style.

New in version 3.10.

Return type:

List[str]

labelSettingsRemoved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

labelSettingsRenamed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

legendPatchShape(self, name: str) QgsLegendPatchShape

Returns the legend patch shape with the specified name.

New in version 3.14.

Parameters:

name (str) –

Return type:

QgsLegendPatchShape

legendPatchShapeNames(self) List[str]

Returns a list of names of legend patch shapes in the style.

New in version 3.14.

Return type:

List[str]

legendPatchShapeSymbolType(self, name: str) Qgis.SymbolType

Returns the symbol type corresponding to the legend patch shape with the specified name, or QgsSymbol.Hybrid if a matching legend patch shape is not present.

New in version 3.14.

Parameters:

name (str) –

Return type:

Qgis.SymbolType

legendPatchShapesCount(self) int

Returns count of legend patch shapes in the style.

New in version 3.14.

Return type:

int

load(self, filename: str) bool

Loads a file into the style

This function will load an on-disk database and populate styles.

Parameters:

filename (str) – location of the database to load styles from

Return type:

bool

Returns:

True if the database was successfully loaded. If False is returned then a detailed error message can be retrieved via errorString().

See also

errorString()

name(self) str

Returns the name of the style.

See also

setName()

New in version 3.26.

Return type:

str

previewSymbolForPatchShape(self, shape: QgsLegendPatchShape) QgsSymbol

Returns a symbol to use for rendering preview icons for a patch shape.

Ownership of the symbol is not transferred.

New in version 3.14.

Parameters:

shape (QgsLegendPatchShape) –

Return type:

QgsSymbol

rampAdded

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

rampChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

rampRemoved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

rampRenamed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

rebuildIconPreviews

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

receivers(self, PYQT_SIGNAL) int
remove(self, type: QgsStyle.StyleEntity, id: int) bool

Removes the specified entity from the database.

Parameters:
  • type (QgsStyle.StyleEntity) – is any of the style entities. Refer enum StyleEntity.

  • id (int) – is the database id of the entity to be removed

Return type:

bool

removeColorRamp(self, name: str) bool

Removes color ramp from style (and delete it)

Parameters:

name (str) –

Return type:

bool

removeEntityByName(self, type: QgsStyle.StyleEntity, name: str) bool

Removes the entry of the specified type with matching name from the database.

See also

remove()

New in version 3.14.

Parameters:
Return type:

bool

removeFavorite(self, type: QgsStyle.StyleEntity, name: str) bool

Removes the specified symbol from favorites

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity of ColorrampEntity

  • name (str) – is the name of the symbol or coloramp whose is to be removed from favorites

Return type:

bool

Returns:

returns the success state as bool

removeLabelSettings(self, name: str) bool

Removes label settings from the style.

New in version 3.10.

Parameters:

name (str) –

Return type:

bool

removeSymbol(self, name: str) bool

Removes symbol from style (and delete it)

Parameters:

name (str) –

Return type:

bool

removeTextFormat(self, name: str) bool

Removes a text format from the style.

New in version 3.10.

Parameters:

name (str) –

Return type:

bool

rename(self, type: QgsStyle.StyleEntity, id: int, newName: str) bool

Renames the given entity with the specified id

Parameters:
  • type (QgsStyle.StyleEntity) – is any of the style entities. Refer enum StyleEntity.

  • id (int) – is the database id of the entity which is to be renamed

  • newName (str) – is the new name of the entity

Return type:

bool

renameColorRamp(self, oldName: str, newName: str) bool

Changes ramp’s name

Parameters:
  • oldName (str) –

  • newName (str) –

Return type:

bool

renameEntity(self, type: QgsStyle.StyleEntity, oldName: str, newName: str) bool

Renames an entity of the specified type from oldName to newName.

Returns True if the entity was successfully renamed.

New in version 3.14.

Parameters:
Return type:

bool

renameLabelSettings(self, oldName: str, newName: str) bool

Changes a label setting’s name.

New in version 3.10.

Parameters:
  • oldName (str) –

  • newName (str) –

Return type:

bool

renameLegendPatchShape(self, oldName: str, newName: str) bool

Changes a legend patch shape’s name.

New in version 3.14.

Parameters:
  • oldName (str) –

  • newName (str) –

Return type:

bool

renameSymbol(self, oldName: str, newName: str) bool

Renames a symbol from oldName to newName.

Returns True if symbol was successfully renamed.

Parameters:
  • oldName (str) –

  • newName (str) –

Return type:

bool

renameSymbol3D(self, oldName: str, newName: str) bool

Changes a 3d symbol’s name.

New in version 3.16.

Parameters:
  • oldName (str) –

  • newName (str) –

Return type:

bool

renameTextFormat(self, oldName: str, newName: str) bool

Changes a text format’s name.

New in version 3.10.

Parameters:
  • oldName (str) –

  • newName (str) –

Return type:

bool

save(self, filename: str = '') bool

Saves style into a file.

The current fileName() will be used if no explicit filename is specified.

Return type:

bool

Returns:

True if the style was successfully saved. If False is returned then a detailed error message can be retrieved via errorString().

See also

fileName()

See also

load()

See also

errorString()

Deprecated since version This: function has no effect.

Parameters:

filename (str = '') –

saveColorRamp(self, name: str, ramp: QgsColorRamp, favorite: bool, tags: Iterable[str]) bool

Adds the colorramp to the database.

Parameters:
  • name (str) – is the name of the colorramp as QString

  • ramp (QgsColorRamp) – is the pointer to the new QgsColorRamp being saved

  • favorite (bool) – is a boolean value to specify whether the colorramp should be added to favorites

  • tags (Iterable[str]) – is a list of tags that are associated with the color ramp as a QStringList.

Return type:

bool

Returns:

returns the success state of the save operation

saveLabelSettings(self, name: str, settings: QgsPalLayerSettings, favorite: bool, tags: Iterable[str]) bool

Adds label settings to the database.

Parameters:
  • name (str) – is the name of the label settings

  • settings (QgsPalLayerSettings) – label settings to save

  • favorite (bool) – is a boolean value to specify whether the label settings should be added to favorites

  • tags (Iterable[str]) – is a list of tags that are associated with the label settings

Return type:

bool

Returns:

returns the success state of the save operation

saveLegendPatchShape(self, name: str, shape: QgsLegendPatchShape, favorite: bool, tags: Iterable[str]) bool

Adds a legend patch shape to the database.

Parameters:
  • name (str) – is the name of the legend patch shape

  • shape (QgsLegendPatchShape) – legend patch shape to save

  • favorite (bool) – is a boolean value to specify whether the legend patch shape should be added to favorites

  • tags (Iterable[str]) – is a list of tags that are associated with the legend patch shape

Return type:

bool

Returns:

returns the success state of the save operation

New in version 3.14.

saveSymbol(self, name: str, symbol: QgsSymbol, favorite: bool, tags: Iterable[str]) bool

Adds the symbol to the database with tags.

Parameters:
  • name (str) – is the name of the symbol as QString

  • symbol (QgsSymbol) – is the pointer to the new QgsSymbol being saved

  • favorite (bool) – is a boolean value to specify whether the symbol should be added to favorites

  • tags (Iterable[str]) – is a list of tags that are associated with the symbol as a QStringList.

Return type:

bool

Returns:

returns the success state of the save operation

saveSymbol3D(self, name: str, symbol: QgsAbstract3DSymbol, favorite: bool, tags: Iterable[str]) bool

Adds a 3d symbol to the database.

Parameters:
  • name (str) – is the name of the 3d symbol

  • symbol (QgsAbstract3DSymbol) – 3d symbol to save. Ownership is transferred.

  • favorite (bool) – is a boolean value to specify whether the 3d symbol should be added to favorites

  • tags (Iterable[str]) – is a list of tags that are associated with the 3d symbol

Return type:

bool

Returns:

returns the success state of the save operation

New in version 3.16.

saveTextFormat(self, name: str, format: QgsTextFormat, favorite: bool, tags: Iterable[str]) bool

Adds a text format to the database.

Parameters:
  • name (str) – is the name of the text format

  • format (QgsTextFormat) – text format to save

  • favorite (bool) – is a boolean value to specify whether the text format should be added to favorites

  • tags (Iterable[str]) – is a list of tags that are associated with the text format

Return type:

bool

Returns:

returns the success state of the save operation

sender(self) QObject
senderSignalIndex(self) int
setFileName(self, filename: str)

Sets the current file name of the style database.

The filename should always represent the actual source of the style - e.g. the .db file for styles associated with a database, or the original source .xml file for styles directly loaded from a .xml export.

Calling load() automatically sets the filename to the .db file path.

New in version 3.26.

Parameters:

filename (str) –

setName(self, name: str)

Sets the name of the style.

See also

name()

New in version 3.26.

Parameters:

name (str) –

setReadOnly(self, readOnly: bool)

Sets whether the style is considered a read-only library.

Note

This flag is used to control GUI operations, and does not prevent calling functions which mutate the style directly via the API.

See also

isReadOnly()

New in version 3.26.

Parameters:

readOnly (bool) –

smartgroup(self, id: int) Dict[str, List[str]]

Returns the QgsSmartConditionMap for the given id

Parameters:

id (int) –

Return type:

Dict[str, List[str]]

smartgroupId(self, smartgroup: str) int

Returns the database id for the given smartgroup name

Parameters:

smartgroup (str) –

Return type:

int

smartgroupNames(self) List[str]

Returns the smart groups list

Return type:

List[str]

smartgroupOperator(self, id: int) str

Returns the operator for the smartgroup.

Parameters:

id (int) –

Return type:

str

smartgroupsListMap(self) Dict[int, str]

Returns the smart groups map with id as key and name as value

Return type:

Dict[int, str]

symbol(self, name: str) QgsSymbol

Returns a NEW copy of symbol

Parameters:

name (str) –

Return type:

QgsSymbol

symbol3D(self, name: str) QgsAbstract3DSymbol

Returns a new copy of the 3D symbol with the specified name.

New in version 3.16.

Parameters:

name (str) –

Return type:

QgsAbstract3DSymbol

symbol3DCompatibleGeometryTypes(self, name: str) List[Qgis.GeometryType]

Returns the list of the vector layer geometry types which are compatible with the 3D symbol with the specified name, or an empty list if a matching 3d symbol is not present.

New in version 3.16.

Parameters:

name (str) –

Return type:

List[Qgis.GeometryType]

symbol3DCount(self) int

Returns count of 3D symbols in the style.

New in version 3.16.

Return type:

int

symbol3DNames(self) List[str]

Returns a list of names of 3d symbols in the style.

New in version 3.16.

Return type:

List[str]

symbolChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

symbolCount(self) int

Returns count of symbols in style

Return type:

int

symbolHasTag(self, type: QgsStyle.StyleEntity, symbol: str, tag: str) bool

Returns whether a given tag is associated with the symbol

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity or ColorrampEntity

  • symbol (str) – is the name of the symbol or color ramp

  • tag (str) – the name of the tag to look for

Return type:

bool

Returns:

A boolean value identicating whether a tag was found attached to the symbol

symbolId(self, name: str) int

Returns the id in the style database for the given symbol name returns 0 if not found

Parameters:

name (str) –

Return type:

int

symbolNames(self) List[str]

Returns a list of names of symbols

Return type:

List[str]

symbolRef(self, name: str) QgsSymbol

Returns a const pointer to a symbol (doesn’t create new instance)

Parameters:

name (str) –

Return type:

QgsSymbol

symbolRemoved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

symbolRenamed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

symbolSaved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

symbolsOfFavorite(self, type: QgsStyle.StyleEntity) List[str]

Returns the symbol names which are flagged as favorite

Parameters:

type (QgsStyle.StyleEntity) – is either SymbolEntity or ColorampEntity

Return type:

List[str]

Returns:

A QStringList of the symbol or colorramp names flagged as favorite

symbolsOfSmartgroup(self, type: QgsStyle.StyleEntity, id: int) List[str]

Returns the symbols for the smartgroup

Parameters:
Return type:

List[str]

symbolsWithTag(self, type: QgsStyle.StyleEntity, tagid: int) List[str]

Returns the symbol names with which have the given tag

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity or ColorampEntity

  • tagid (int) – is id of the tag which has been applied over the symbol as int

Return type:

List[str]

Returns:

A QStringList of the symbol or colorramp names for the given tag id

tag(self, id: int) str

Returns the tag name for the given id

Parameters:

id (int) –

Return type:

str

tagId(self, tag: str) int

Returns the database id for the given tag name

Parameters:

tag (str) –

Return type:

int

tagSymbol(self, type: QgsStyle.StyleEntity, symbol: str, tags: Iterable[str]) bool

Tags the symbol with the tags in the list

Applies the given tags to the given symbol or colorramp

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity or ColorrampEntity

  • symbol (str) – is the name of the symbol or colorramp as QString

  • tags (Iterable[str]) – is the list of the tags that are to be applied as QStringList

Return type:

bool

Returns:

returns the success state of the operation

tags(self) List[str]

Returns a list of all tags in the style database

See also

addTag()

New in version 2.16.

Return type:

List[str]

tagsOfSymbol(self, type: QgsStyle.StyleEntity, symbol: str) List[str]

Returns the tags associated with the symbol

Parameters:
  • type (QgsStyle.StyleEntity) – is either SymbolEntity or ColorrampEntity

  • symbol (str) – is the name of the symbol or color ramp

Return type:

List[str]

Returns:

A QStringList of the tags that have been applied to that symbol/colorramp

textFormat(self, name: str) QgsTextFormat

Returns the text format with the specified name.

New in version 3.10.

Parameters:

name (str) –

Return type:

QgsTextFormat

textFormatAdded

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

textFormatChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

textFormatCount(self) int

Returns count of text formats in the style.

New in version 3.10.

Return type:

int

textFormatId(self, name: str) int

Returns the ID in the style database for the given text format by name. Returns 0 if the text format was not found.

New in version 3.10.

Parameters:

name (str) –

Return type:

int

textFormatNames(self) List[str]

Returns a list of names of text formats in the style.

New in version 3.10.

Return type:

List[str]

textFormatRemoved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

textFormatRenamed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

timerEvent(self, QTimerEvent)