Class: QgsSymbolLayerRegistry

class qgis.core.QgsSymbolLayerRegistry

Bases: sip.wrapper

Registry of available symbol layer classes.

QgsSymbolLayerRegistry is not usually directly created, but rather accessed through QgsApplication.symbolLayerRegistry().

Methods

addSymbolLayerType

register a new symbol layer type.

createSymbolLayer

create a new instance of symbol layer given symbol layer name and properties

createSymbolLayerFromSld

create a new instance of symbol layer given symbol layer name and SLD

defaultSymbolLayer

create a new instance of symbol layer for specified symbol type with default settings

resolveFonts

Resolve fonts from the properties of a particular symbol layer.

resolvePaths

Resolve paths in properties of a particular symbol layer.

symbolLayerMetadata

Returns metadata for specified symbol layer.

symbolLayersForType

Returns a list of available symbol layers for a specified symbol type

addSymbolLayerType(self, metadata: QgsSymbolLayerAbstractMetadata)bool

register a new symbol layer type. Takes ownership of the metadata instance.

Parameters

metadata (QgsSymbolLayerAbstractMetadata) –

Return type

bool

createSymbolLayer(self, name: str, properties: Dict[str, Any] = {})QgsSymbolLayer

create a new instance of symbol layer given symbol layer name and properties

Parameters
  • name (str) –

  • properties (Dict[str) –

Return type

QgsSymbolLayer

createSymbolLayerFromSld(self, name: str, element: QDomElement)QgsSymbolLayer

create a new instance of symbol layer given symbol layer name and SLD

Parameters
  • name (str) –

  • element (QDomElement) –

Return type

QgsSymbolLayer

defaultSymbolLayer(type: Qgis.SymbolType)QgsSymbolLayer

create a new instance of symbol layer for specified symbol type with default settings

Parameters

type (Qgis.SymbolType) –

Return type

QgsSymbolLayer

resolveFonts(self, name: str, properties: Dict[str, Any], context: QgsReadWriteContext)

Resolve fonts from the properties of a particular symbol layer.

This tests whether the required fonts from the encoded properties are available on the system, and records warnings in the context if not.

New in version 3.20.

Parameters
resolvePaths(self, name: str, properties: Dict[str, Any], pathResolver: QgsPathResolver, saving: bool)

Resolve paths in properties of a particular symbol layer. This normally means converting relative paths to absolute paths when loading and converting absolute paths to relative paths when saving.

New in version 3.0.

Parameters
  • name (str) –

  • properties (Dict[str) –

  • pathResolver (QgsPathResolver) –

  • saving (bool) –

symbolLayerMetadata(self, name: str)QgsSymbolLayerAbstractMetadata

Returns metadata for specified symbol layer. Returns None if not found

Parameters

name (str) –

Return type

QgsSymbolLayerAbstractMetadata

symbolLayersForType(self, type: Qgis.SymbolType)List[str]

Returns a list of available symbol layers for a specified symbol type

Parameters

type (Qgis.SymbolType) –

Return type

List[str]