QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
49
51
53
56
59
67
75
84 QString minimumLabel() const;
85
94 void setMinimumLabel( const QString &label );
95
104 QString maximumLabel() const;
105
114 void setMaximumLabel( const QString &label );
115
122 const QgsNumericFormat *numericFormat() const;
123
133
137 void writeXml( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
138
142 void readXml( const QDomElement &element, const QgsReadWriteContext &context );
143
150 QString prefix() const;
151
158 void setPrefix( const QString &prefix );
159
166 QString suffix() const;
167
174 void setSuffix( const QString &suffix );
175
182
188 void setTextFormat( const QgsTextFormat &format );
189
196 Qt::Orientation orientation() const;
197
204 void setOrientation( Qt::Orientation orientation );
205
211 bool useContinuousLegend() const;
212
224
225 private:
226 bool mUseContinuousLegend = true;
227 QString mMinimumLabel;
228 QString mMaximumLabel;
229 QString mPrefix;
230 QString mSuffix;
231 Direction mDirection = MinimumToMaximum;
232 std::unique_ptr< QgsNumericFormat > mNumericFormat;
233 QgsTextFormat mTextFormat;
234 Qt::Orientation mOrientation = Qt::Vertical;
235};
236
237#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:133
#define SIP_TRANSFER
Definition qgis_sip.h:35