Class: QgsMapLayerStyle

class qgis.core.QgsMapLayerStyle

Bases: sip.wrapper

construct invalid style

QgsMapLayerStyle(xmlData: str) construct style from QML definition (XML)

QgsMapLayerStyle(QgsMapLayerStyle)

Stores style information (renderer, opacity, labeling, diagrams etc.) applicable to a map layer.

Stored data are considered as opaque - it is not possible to access them directly or modify them - it is only possible to read or write layer’s current style.

New in version 2.8: Enums

Methods

clear

Remove any stored style data (will get invalid)

isValid

Tell whether the style is valid (i.e.

readFromLayer

Store layer’s active style information in the instance

readXml

Read style configuration (for project file reading)

writeToLayer

Apply stored layer’s style information to the layer

writeXml

Write style configuration (for project file writing)

xmlData

Returns XML content of the style

Signals

Attributes

clear(self)

Remove any stored style data (will get invalid)

isValid(self) → bool

Tell whether the style is valid (i.e. there is something stored in it)

readFromLayer(self, layer: QgsMapLayer)

Store layer’s active style information in the instance

readXml(self, styleElement: QDomElement)

Read style configuration (for project file reading)

writeToLayer(self, layer: QgsMapLayer)

Apply stored layer’s style information to the layer

writeXml(self, styleElement: QDomElement)

Write style configuration (for project file writing)

xmlData(self) → str

Returns XML content of the style