Class: QgsMapLayerStyle¶
- class qgis.core.QgsMapLayerStyle¶
Bases:
sip.wrapper
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.
QgsMapLayerStyle() construct invalid style
QgsMapLayerStyle(xmlData: str) construct style from QML definition (XML)
QgsMapLayerStyle(
QgsMapLayerStyle
)Methods
Remove any stored style data (will get invalid)
Tell whether the style is valid (i.e. there is something stored in it).
Store layer's active style information in the instance
Read style configuration (for project file reading)
Apply stored layer's style information to the layer
Write style configuration (for project file writing)
Returns XML content of the style
- 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)
- Return type:
bool
- readFromLayer(self, layer: QgsMapLayer)¶
Store layer’s active style information in the instance
- Parameters:
layer (QgsMapLayer) –
- readXml(self, styleElement: QDomElement)¶
Read style configuration (for project file reading)
- Parameters:
styleElement (QDomElement) –
- writeToLayer(self, layer: QgsMapLayer)¶
Apply stored layer’s style information to the layer
- Parameters:
layer (QgsMapLayer) –
- writeXml(self, styleElement: QDomElement)¶
Write style configuration (for project file writing)
- Parameters:
styleElement (QDomElement) –
- xmlData(self) str ¶
Returns XML content of the style
- Return type:
str