QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgscurrencynumericformat.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscurrencynumericformat.h
3  ----------------------------
4  begin : January 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 #ifndef QGSCURRENCYNUMERICFORMAT_H
16 #define QGSCURRENCYNUMERICFORMAT_H
17 
18 #include "qgis_core.h"
19 #include "qgis_sip.h"
20 #include "qgsbasicnumericformat.h"
21 
29 {
30  public:
31 
36 
37  QString id() const override;
38  QString visibleName() const override;
39  int sortKey() override;
40  double suggestSampleValue() const override;
41  QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
42  QgsNumericFormat *clone() const override SIP_FACTORY;
43  QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
44  QVariantMap configuration( const QgsReadWriteContext &context ) const override;
45 
50  QString prefix() const;
51 
56  void setPrefix( const QString &prefix );
57 
62  QString suffix() const;
63 
68  void setSuffix( const QString &suffix );
69 
70  private:
71 
72  QString mPrefix;
73  QString mSuffix;
74 
75 };
76 
77 #endif // QGSCURRENCYNUMERICFORMAT_H
QgsBasicNumericFormat::clone
QgsNumericFormat * clone() const override
Clones the format, returning a new object.
Definition: qgsbasicnumericformat.cpp:131
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
QgsBasicNumericFormat::id
QString id() const override
Returns a unique id for this numeric format.
Definition: qgsbasicnumericformat.cpp:44
QgsNumericFormat
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
Definition: qgsnumericformat.h:218
QgsBasicNumericFormat
A numeric formatter which returns a simple text representation of a value.
Definition: qgsbasicnumericformat.h:32
QgsBasicNumericFormat::create
QgsNumericFormat * create(const QVariantMap &configuration, const QgsReadWriteContext &context) const override
Creates a new copy of the format, using the supplied configuration.
Definition: qgsbasicnumericformat.cpp:136
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgis_sip.h
QgsBasicNumericFormat::sortKey
int sortKey() override
Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists.
Definition: qgsbasicnumericformat.cpp:54
QgsNumericFormat::suggestSampleValue
virtual double suggestSampleValue() const
Returns a suggested sample value which nicely represents the current format configuration.
Definition: qgsnumericformat.cpp:40
QgsBasicNumericFormat::configuration
QVariantMap configuration(const QgsReadWriteContext &context) const override
Returns the current configuration of the formatter.
Definition: qgsbasicnumericformat.cpp:143
qgsbasicnumericformat.h
QgsBasicNumericFormat::formatDouble
QString formatDouble(double value, const QgsNumericFormatContext &context) const override
Returns a formatted string representation of a numeric double value.
Definition: qgsbasicnumericformat.cpp:59
QgsCurrencyNumericFormat
A numeric formatter which returns a text representation of a currency value.
Definition: qgscurrencynumericformat.h:29
QgsBasicNumericFormat::visibleName
QString visibleName() const override
Returns the translated, user-visible name for this format.
Definition: qgsbasicnumericformat.cpp:49
QgsNumericFormatContext
A context for numeric formats.
Definition: qgsnumericformat.h:35