QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
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 | |
virtual | ~QgsNumericFormat ()=default |
virtual QgsNumericFormat * | clone () const =0 |
Clones the format, returning a new object. | |
virtual QVariantMap | configuration (const QgsReadWriteContext &context) const =0 |
Returns the current configuration of the formatter. | |
virtual QgsNumericFormat * | create (const QVariantMap &configuration, const QgsReadWriteContext &context) const =0 |
Creates a new copy of the format, using the supplied configuration. | |
virtual QString | formatDouble (double value, const QgsNumericFormatContext &context) const =0 |
Returns a formatted string representation of a numeric double value. | |
virtual QString | id () const =0 |
Returns a unique id for this numeric format. | |
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. | |
virtual double | suggestSampleValue () const |
Returns a suggested sample value which nicely represents the current format configuration. | |
virtual QString | visibleName () const =0 |
Returns the translated, user-visible name for this format. | |
void | writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const |
Writes the format to an XML element. | |
Static Protected Attributes | |
static constexpr int | DEFAULT_SORT_KEY = 100 |
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 278 of file qgsnumericformat.h.
|
default |
|
virtualdefault |
|
pure virtual |
Clones the format, returning a new object.
The caller takes ownership of the returned object.
Implemented in QgsBasicNumericFormat, QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsExpressionBasedNumericFormat, QgsFallbackNumericFormat, QgsFractionNumericFormat, QgsPercentageNumericFormat, and QgsScientificNumericFormat.
|
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 QgsBasicNumericFormat, QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsExpressionBasedNumericFormat, QgsFallbackNumericFormat, QgsFractionNumericFormat, QgsPercentageNumericFormat, and QgsScientificNumericFormat.
|
pure virtual |
Creates a new copy of the format, using the supplied configuration.
The caller takes ownership of the returned object.
Implemented in QgsBasicNumericFormat, QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsExpressionBasedNumericFormat, QgsFallbackNumericFormat, QgsFractionNumericFormat, QgsPercentageNumericFormat, and QgsScientificNumericFormat.
|
pure virtual |
Returns a formatted string representation of a numeric double value.
Implemented in QgsBasicNumericFormat, QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsExpressionBasedNumericFormat, QgsFallbackNumericFormat, QgsFractionNumericFormat, QgsPercentageNumericFormat, and QgsScientificNumericFormat.
|
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 QgsBasicNumericFormat, QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsExpressionBasedNumericFormat, QgsFallbackNumericFormat, QgsFractionNumericFormat, QgsPercentageNumericFormat, and QgsScientificNumericFormat.
bool QgsNumericFormat::operator!= | ( | const QgsNumericFormat & | other | ) | const |
Definition at line 82 of file qgsnumericformat.cpp.
bool QgsNumericFormat::operator== | ( | const QgsNumericFormat & | other | ) | const |
Definition at line 77 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 QgsBasicNumericFormat, QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsExpressionBasedNumericFormat, QgsFallbackNumericFormat, QgsFractionNumericFormat, QgsPercentageNumericFormat, and QgsScientificNumericFormat.
Definition at line 59 of file qgsnumericformat.cpp.
|
virtual |
Returns a suggested sample value which nicely represents the current format configuration.
Reimplemented in QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsFractionNumericFormat, and QgsPercentageNumericFormat.
Definition at line 64 of file qgsnumericformat.cpp.
|
pure virtual |
Returns the translated, user-visible name for this format.
Implemented in QgsBasicNumericFormat, QgsBearingNumericFormat, QgsGeographicCoordinateNumericFormat, QgsCurrencyNumericFormat, QgsExpressionBasedNumericFormat, QgsFallbackNumericFormat, QgsFractionNumericFormat, QgsPercentageNumericFormat, and QgsScientificNumericFormat.
void QgsNumericFormat::writeXml | ( | QDomElement & | element, |
QDomDocument & | document, | ||
const QgsReadWriteContext & | context | ||
) | const |
Writes the format to an XML element.
Definition at line 69 of file qgsnumericformat.cpp.
|
staticconstexprprotected |
Definition at line 372 of file qgsnumericformat.h.