QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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 <memory>
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgstextformat.h"
24
25#include <QString>
26
29class QDomDocument;
30class QDomElement;
31
39{
40 public:
41
50
52
54
57
60
68
76
85 QString minimumLabel() const;
86
95 void setMinimumLabel( const QString &label );
96
105 QString maximumLabel() const;
106
115 void setMaximumLabel( const QString &label );
116
123 const QgsNumericFormat *numericFormat() const;
124
134
138 void writeXml( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
139
143 void readXml( const QDomElement &element, const QgsReadWriteContext &context );
144
151 QString prefix() const;
152
159 void setPrefix( const QString &prefix );
160
167 QString suffix() const;
168
175 void setSuffix( const QString &suffix );
176
183
189 void setTextFormat( const QgsTextFormat &format );
190
197 Qt::Orientation orientation() const;
198
205 void setOrientation( Qt::Orientation orientation );
206
212 bool useContinuousLegend() const;
213
225
226 private:
227 bool mUseContinuousLegend = true;
228 QString mMinimumLabel;
229 QString mMaximumLabel;
230 QString mPrefix;
231 QString mSuffix;
232 Direction mDirection = MinimumToMaximum;
233 std::unique_ptr< QgsNumericFormat > mNumericFormat;
234 QgsTextFormat mTextFormat;
235 Qt::Orientation mOrientation = Qt::Vertical;
236};
237
238#endif // QGSCOLORRAMPLEGENDNODESETTINGS_H
Settings for a color ramp legend node.
void setDirection(QgsColorRampLegendNodeSettings::Direction direction)
Sets the direction of the ramp.
QgsColorRampLegendNodeSettings & operator=(const QgsColorRampLegendNodeSettings &other)
void setMaximumLabel(const QString &label)
Sets the label for the maximum value on the ramp.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used for numbers in the scalebar.
bool useContinuousLegend() const
Returns true if a continuous gradient legend will be used.
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from an XML element.
void writeXml(QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to an XML element.
const QgsNumericFormat * numericFormat() const
Returns the numeric format used for numbers in the scalebar.
QString maximumLabel() const
Returns the label for the maximum value on the ramp.
QString suffix() const
Returns the suffix to show after legend text.
void setPrefix(const QString &prefix)
Sets the prefix to show before legend text.
void setUseContinuousLegend(bool useContinuousLegend)
Sets the flag to use a continuous gradient legend to useContinuousLegend.
void setOrientation(Qt::Orientation orientation)
Sets the ramp orientation (i.e.
@ MaximumToMinimum
Maximum value on bottom, minimum value on top.
@ MinimumToMaximum
Minimum value on bottom, maximum value on top.
void setSuffix(const QString &suffix)
Sets the suffix to show after legend text.
QString prefix() const
Returns the prefix to show before legend text.
Qt::Orientation orientation() const
Returns the ramp orientation (i.e.
QgsColorRampLegendNodeSettings::Direction direction() const
Returns the direction of the ramp.
QgsTextFormat textFormat() const
Returns the text format used to render text in the legend item.
void setMinimumLabel(const QString &label)
Sets the label for the minimum value on the ramp.
void setTextFormat(const QgsTextFormat &format)
Sets the text format used to render text in the legend item.
QString minimumLabel() const
Returns the label for the minimum value on the ramp.
Abstract base class for numeric formatters, which allow for formatting a numeric value for display.
A container for the context for various read/write operations on objects.
Container for all settings relating to text rendering.
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFER
Definition qgis_sip.h:36