QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
qgscolorramplegendnodesettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscolorramplegendnode.h
3  --------------------------------------
4  Date : December 2020
5  Copyright : (C) 2020 by Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
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 QGSCOLORRAMPLEGENDNODESETTINGS_H
17 #define QGSCOLORRAMPLEGENDNODESETTINGS_H
18 
19 #include "qgis_core.h"
20 #include "qgis_sip.h"
21 
22 #include "qgstextformat.h"
23 #include <QString>
24 #include <memory>
25 
26 class QgsNumericFormat;
28 class QDomDocument;
29 class QDomElement;
30 
38 {
39  public:
40 
44  enum Direction
45  {
48  };
49 
51 
53 
56 
58 
66 
73  void setDirection( QgsColorRampLegendNodeSettings::Direction direction );
74 
83  QString minimumLabel() const;
84 
93  void setMinimumLabel( const QString &label );
94 
103  QString maximumLabel() const;
104 
113  void setMaximumLabel( const QString &label );
114 
121  const QgsNumericFormat *numericFormat() const;
122 
131  void setNumericFormat( QgsNumericFormat *format SIP_TRANSFER );
132 
136  void writeXml( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
137 
141  void readXml( const QDomElement &element, const QgsReadWriteContext &context );
142 
149  QString prefix() const;
150 
157  void setPrefix( const QString &prefix );
158 
165  QString suffix() const;
166 
173  void setSuffix( const QString &suffix );
174 
180  QgsTextFormat textFormat() const;
181 
187  void setTextFormat( const QgsTextFormat &format );
188 
195  Qt::Orientation orientation() const;
196 
203  void setOrientation( Qt::Orientation orientation );
204 
210  bool useContinuousLegend() const;
211 
222  void setUseContinuousLegend( bool useContinuousLegend );
223 
224  private:
225  bool mUseContinuousLegend = true;
226  QString mMinimumLabel;
227  QString mMaximumLabel;
228  QString mPrefix;
229  QString mSuffix;
230  Direction mDirection = MinimumToMaximum;
231  std::unique_ptr< QgsNumericFormat > mNumericFormat;
232  QgsTextFormat mTextFormat;
233  Qt::Orientation mOrientation = Qt::Vertical;
234 };
235 
236 #endif // QGSCOLORRAMPLEGENDNODESETTINGS_H
Settings for a color ramp legend node.
@ MaximumToMinimum
Maximum value on bottom, minimum value on top.
@ MinimumToMaximum
Minimum value on bottom, maximum value on top.
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
The class is used as a container of context for various read/write operations on other objects.
Container for all settings relating to text rendering.
Definition: qgstextformat.h:41
#define SIP_TRANSFER
Definition: qgis_sip.h:36