QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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
6  Email : [email protected]
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 
28 class QDomElement;
29 class QgsMapLayer;
30 
42 class 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 
81 class 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
QgsMapLayerStyleOverride::QgsMapLayerStyleOverride
QgsMapLayerStyleOverride(QgsMapLayer *layer)
Construct a style override object associated with a map layer.
Definition: qgsmaplayerstyle.h:89
QgsMapLayerStyleOverride
Definition: qgsmaplayerstyle.h:81
qgis_sip.h
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsMapLayerStyle
Definition: qgsmaplayerstyle.h:42