QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
A numeric formatter allows for formatting a numeric value for display, using a variety of different formatting techniques (e.g. More...
#include <qgsnumericformat.h>
Public Member Functions | |
QgsNumericFormat ()=default | |
Default constructor. More... | |
virtual | ~QgsNumericFormat ()=default |
virtual QgsNumericFormat * | clone () const =0 |
Clones the format, returning a new object. More... | |
virtual QVariantMap | configuration (const QgsReadWriteContext &context) const =0 |
Returns the current configuration of the formatter. More... | |
virtual QgsNumericFormat * | create (const QVariantMap &configuration, const QgsReadWriteContext &context) const =0 |
Creates a new copy of the format, using the supplied configuration. More... | |
virtual QString | formatDouble (double value, const QgsNumericFormatContext &context) const =0 |
Returns a formatted string representation of a numeric double value. More... | |
virtual QString | id () const =0 |
Returns a unique id for this numeric format. More... | |
bool | operator!= (const QgsNumericFormat &other) const |
bool | operator== (const QgsNumericFormat &other) const |
virtual int | sortKey () |
Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists. More... | |
virtual double | suggestSampleValue () const |
Returns a suggested sample value which nicely represents the current format configuration. More... | |
virtual QString | visibleName () const =0 |
Returns the translated, user-visible name for this format. More... | |
void | writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const |
Writes the format to an XML element. More... | |
A numeric formatter allows for formatting a numeric value for display, using a variety of different formatting techniques (e.g.
as scientific notation, currency values, percentage values, etc)
This is an abstract base class and will always need to be subclassed.
Definition at line 217 of file qgsnumericformat.h.
|
default |
Default constructor.
|
virtualdefault |
|
pure virtual |
Clones the format, returning a new object.
The caller takes ownership of the returned object.
Implemented in QgsScientificNumericFormat, QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsFallbackNumericFormat, QgsCurrencyNumericFormat, QgsBearingNumericFormat, and QgsBasicNumericFormat.
|
pure virtual |
Returns the current configuration of the formatter.
This value can be used in a call to create() in order to recreate this formatter in its current state.
Implemented in QgsScientificNumericFormat, QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsFallbackNumericFormat, QgsCurrencyNumericFormat, QgsBearingNumericFormat, and QgsBasicNumericFormat.
|
pure virtual |
Creates a new copy of the format, using the supplied configuration.
The caller takes ownership of the returned object.
Implemented in QgsScientificNumericFormat, QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsFallbackNumericFormat, QgsCurrencyNumericFormat, QgsBearingNumericFormat, and QgsBasicNumericFormat.
|
pure virtual |
Returns a formatted string representation of a numeric double value.
Implemented in QgsScientificNumericFormat, QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsFallbackNumericFormat, QgsCurrencyNumericFormat, QgsBearingNumericFormat, and QgsBasicNumericFormat.
|
pure virtual |
Returns a unique id for this numeric format.
This id is used to identify this numeric format in the registry with QgsNumericFormatRegistry::format().
Implemented in QgsScientificNumericFormat, QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsFallbackNumericFormat, QgsCurrencyNumericFormat, QgsBearingNumericFormat, and QgsBasicNumericFormat.
bool QgsNumericFormat::operator!= | ( | const QgsNumericFormat & | other | ) | const |
Definition at line 58 of file qgsnumericformat.cpp.
bool QgsNumericFormat::operator== | ( | const QgsNumericFormat & | other | ) | const |
Definition at line 53 of file qgsnumericformat.cpp.
|
virtual |
Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists.
Generally, subclasses should return QgsNumericFormat::sortKey() as their sorting key.
Reimplemented in QgsScientificNumericFormat, QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsFallbackNumericFormat, QgsCurrencyNumericFormat, QgsBearingNumericFormat, and QgsBasicNumericFormat.
Definition at line 35 of file qgsnumericformat.cpp.
|
virtual |
Returns a suggested sample value which nicely represents the current format configuration.
Reimplemented in QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsCurrencyNumericFormat, and QgsBearingNumericFormat.
Definition at line 40 of file qgsnumericformat.cpp.
|
pure virtual |
Returns the translated, user-visible name for this format.
Implemented in QgsScientificNumericFormat, QgsPercentageNumericFormat, QgsFractionNumericFormat, QgsFallbackNumericFormat, QgsCurrencyNumericFormat, QgsBearingNumericFormat, and QgsBasicNumericFormat.
void QgsNumericFormat::writeXml | ( | QDomElement & | element, |
QDomDocument & | document, | ||
const QgsReadWriteContext & | context | ||
) | const |
Writes the format to an XML element.
Definition at line 45 of file qgsnumericformat.cpp.