Class: QgsSymbolLayerId

class qgis.core.QgsSymbolLayerId

Bases: sip.wrapper

We may need stable references to symbol layers, when pointers to symbol layers is not usable (when a symbol or a feature renderer is cloned for example).

A symbol layer identifier consists of:

  • an identifier to its symbol (given by the QgsFeatureRenderer)

  • a path of indexes inside its symbol and subsymbols.

For a symbol in a QgsSingleSymbolRenderer that has two symbol layers, it will give:

  • “” for the symbol key

  • [0] and [1] for the two symbol layer indexes

For a QgsRuleBasedRenderer each rule key is the symbol key.

For a symbol with a symbol layer that has a sub symbol (say a QgsArrowSymbolLayer), path to symbol layers of the sub symbol are given by a list of indexes:

  • [0, 0] : first symbol layer of the sub symbol of the first symbol layer

  • [0, 1] : second symbol layer of the sub symbol of the first symbol layer

  • [2, 0] : first symbol layer of the sub symbol of the third symbol layer, etc.

New in version 3.12.

QgsSymbolLayerId()

QgsSymbolLayerId(key: str, index: int) QgsSymbolLayerId constructor with a symbol key and a unique symbol layer index

QgsSymbolLayerId(key: str, indexPath: Iterable[int]) QgsSymbolLayerId constructor with a symbol key and an index path

QgsSymbolLayerId(other: QgsSymbolLayerId) Default copy constructor

Methods

symbolKey

Returns the key associated to the symbol

symbolLayerIndexPath

Returns the symbol layer index path inside the symbol

symbolKey(self)str

Returns the key associated to the symbol

Return type

str

symbolLayerIndexPath(self)List[int]

Returns the symbol layer index path inside the symbol

Return type

List[int]