Class: 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.
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  | 
- class qgis.core.QgsMapLayerStyle[source]¶
 Bases:
object- __init__()
 construct invalid style
- __init__(xmlData: str | None)
 construct style from QML definition (XML)
- Parameters:
 xmlData (Optional[str])
- __init__(a0: QgsMapLayerStyle)
 - Parameters:
 a0 (QgsMapLayerStyle)
- isValid(self) bool[source]¶
 Tell whether the style is valid (i.e. there is something stored in it)
- Return type:
 bool
- readFromLayer(self, layer: QgsMapLayer | None)[source]¶
 Store layer’s active style information in the instance
- Parameters:
 layer (Optional[QgsMapLayer])
- readXml(self, styleElement: QDomElement)[source]¶
 Read style configuration (for project file reading)
- Parameters:
 styleElement (QDomElement)
- writeToLayer(self, layer: QgsMapLayer | None)[source]¶
 Apply stored layer’s style information to the layer
- Parameters:
 layer (Optional[QgsMapLayer])