QgsMapLayerStyle class

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.

Constructors, destructors, conversion operators

QgsMapLayerStyle() defaulted
construct invalid style
QgsMapLayerStyle(const QString& xmlData) explicit
construct style from QML definition (XML)

Public functions

void clear()
Remove any stored style data (will get invalid)
auto isValid() const -> bool
Tell whether the style is valid (i.e. there is something stored in it)
void readFromLayer(QgsMapLayer* layer)
Store layer's active style information in the instance.
void readXml(const QDomElement& styleElement)
Read style configuration (for project file reading)
void writeToLayer(QgsMapLayer* layer) const
Apply stored layer's style information to the layer.
void writeXml(QDomElement& styleElement) const
Write style configuration (for project file writing)
auto xmlData() const -> QString
Returns XML content of the style.