QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
41class CORE_EXPORT QgsMapLayerStyle
42{
43 public:
45 QgsMapLayerStyle() = default;
46
48 explicit QgsMapLayerStyle( const QString &xmlData );
49
51 bool isValid() const;
52
54 void clear();
55
57 QString xmlData() const;
58
60 void readFromLayer( QgsMapLayer *layer );
62 void writeToLayer( QgsMapLayer *layer ) const;
63
65 void readXml( const QDomElement &styleElement );
67 void writeXml( QDomElement &styleElement ) const;
68
69 private:
70 QString mXmlData;
71};
72
73
80class CORE_EXPORT QgsMapLayerStyleOverride
81{
82 public:
83
89 : mLayer( layer )
90 {
91 }
92
94
99 void setOverrideStyle( const QString &style );
100
101 private:
102
103 QgsMapLayer *mLayer = nullptr;
104 bool mStyleOverridden = false;
105};
106#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:76