Class: QgsSymbolLayerAbstractMetadata

Stores metadata about one symbol layer class.

Note

It’s necessary to implement createSymbolLayer() function. In C++ you can use QgsSymbolLayerMetadata convenience class.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: createSymbolLayer()

Class Hierarchy

Inheritance diagram of qgis.core.QgsSymbolLayerAbstractMetadata

Subclasses

QgsSymbolLayerMetadata

Convenience metadata class that uses static functions to create symbol layer and its widget.

Abstract Methods

createSymbolLayer

Create a symbol layer of this type given the map of properties.

Methods

name

type

visibleName

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsSymbolLayerAbstractMetadata. See the FAQ for more details.

createSymbolLayerFromSld

Create a symbol layer of this type given the map of properties.

createSymbolLayerWidget

Create widget for symbol layer of this type.

resolveFonts

Resolve fonts from the symbol layer's properties.

resolvePaths

Resolve paths in symbol layer's properties (if there are any paths).

class qgis.core.QgsSymbolLayerAbstractMetadata[source]

Bases: object

__init__(name: str | None, visibleName: str | None, type: Qgis.SymbolType)

Constructor for QgsSymbolLayerAbstractMetadata.

Parameters:
  • name (Optional[str]) – internal symbol layer name (unique identifier)

  • visibleName (Optional[str]) – user visible, translated name for symbol layer

  • type (Qgis.SymbolType) – associated symbol type

__init__(a0: QgsSymbolLayerAbstractMetadata)
Parameters:

a0 (QgsSymbolLayerAbstractMetadata)

abstract createSymbolLayer(self, map: Dict[str, Any]) QgsSymbolLayer | None[source]

Create a symbol layer of this type given the map of properties.

Parameters:

map (Dict[str, Any])

Return type:

Optional[QgsSymbolLayer]

virtual createSymbolLayerFromSld(self, a0: QDomElement) QgsSymbolLayer | None[source]

Create a symbol layer of this type given the map of properties.

Parameters:

a0 (QDomElement)

Return type:

Optional[QgsSymbolLayer]

virtual createSymbolLayerWidget(self, a0: QgsVectorLayer | None) QgsSymbolLayerWidget | None[source]

Create widget for symbol layer of this type. Can return None if there’s no GUI

Parameters:

a0 (Optional[QgsVectorLayer])

Return type:

Optional[QgsSymbolLayerWidget]

name(self) str[source]
Return type:

str

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

Resolve fonts from the symbol layer’s properties.

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

Added in version 3.20.

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

Resolve paths in symbol layer’s properties (if there are any paths). When saving is True, paths are converted from absolute to relative, when saving is False, paths are converted from relative to absolute. This ensures that paths in project files can be relative, but in symbol layer instances the paths are always absolute

Parameters:
type(self) Qgis.SymbolType[source]
Return type:

Qgis.SymbolType

visibleName(self) str[source]
Return type:

str