QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsmaplayerstyle.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaplayersty.h
3 --------------------------------------
4 Date : September 2019
5 Copyright : (C) 2018 by Denis Rouzaud
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSMAPLAYERSTYLE_H
17#define QGSMAPLAYERSTYLE_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21
22#include <QByteArray>
23#include <QMap>
24#include <QStringList>
25#include <QObject>
26
27
28class QDomElement;
29class QgsMapLayer;
30
42class CORE_EXPORT QgsMapLayerStyle
43{
44 public:
46 QgsMapLayerStyle() = default;
47
49 explicit QgsMapLayerStyle( const QString &xmlData );
50
52 bool isValid() const;
53
55 void clear();
56
58 QString xmlData() const;
59
61 void readFromLayer( QgsMapLayer *layer );
63 void writeToLayer( QgsMapLayer *layer ) const;
64
66 void readXml( const QDomElement &styleElement );
68 void writeXml( QDomElement &styleElement ) const;
69
70 private:
71 QString mXmlData;
72};
73
74
81class CORE_EXPORT QgsMapLayerStyleOverride
82{
83 public:
84
90 : mLayer( layer )
91 {
92 }
93
95
100 void setOverrideStyle( const QString &style );
101
102 private:
103
104 QgsMapLayer *mLayer = nullptr;
105 bool mStyleOverridden = false;
106};
107#endif // QGSMAPLAYERSTYLE_H
Restore overridden layer style on destruction.
QgsMapLayerStyleOverride(QgsMapLayer *layer)
Construct a style override object associated with a map layer.
Stores style information (renderer, opacity, labeling, diagrams etc.) applicable to a map layer.
QgsMapLayerStyle()=default
construct invalid style
Base class for all map layer types.
Definition: qgsmaplayer.h:73