QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
The QgsNumericFormatRegistry manages registered classes of QgsNumericFormat. More...
#include <qgsnumericformatregistry.h>
Public Member Functions | |
QgsNumericFormatRegistry () | |
You should not normally need to create your own numeric format registry. More... | |
~QgsNumericFormatRegistry () | |
void | addFormat (QgsNumericFormat *format) |
Adds a new format to the registry. More... | |
QgsNumericFormat * | create (const QString &id, const QVariantMap &configuration, const QgsReadWriteContext &context) const |
Creates a new numeric format by id, using the supplied configuration. More... | |
QgsNumericFormat * | createFromXml (const QDomElement &element, const QgsReadWriteContext &context) const |
Creates a new numeric format from an XML element. More... | |
QgsNumericFormat * | fallbackFormat () const |
Returns a basic numeric formatter which can be used to represent any number in an default manner. More... | |
QgsNumericFormat * | format (const QString &id) const |
Creates a new numeric format by id. More... | |
QStringList | formats () const |
Returns a list of the format IDs currently contained in the registry. More... | |
void | removeFormat (const QString &id) |
Removes the format with matching id from the registry. More... | |
int | sortKey (const QString &id) const |
Returns the sorting key for the format with matching id. More... | |
QString | visibleName (const QString &id) const |
Returns the translated, user-visible name for the format with matching id. More... | |
The QgsNumericFormatRegistry manages registered classes of QgsNumericFormat.
A reference to the QgsFieldFormatterRegistry can be obtained from QgsApplication::numericFormatRegistry().
Definition at line 38 of file qgsnumericformatregistry.h.
|
explicit |
You should not normally need to create your own numeric format registry.
Use the one provided by QgsApplication::numericFormatRegistry()
instead.
Definition at line 27 of file qgsnumericformatregistry.cpp.
QgsNumericFormatRegistry::~QgsNumericFormatRegistry | ( | ) |
Definition at line 38 of file qgsnumericformatregistry.cpp.
void QgsNumericFormatRegistry::addFormat | ( | QgsNumericFormat * | format | ) |
Adds a new format to the registry.
Ownership is transferred to the registry.
Definition at line 48 of file qgsnumericformatregistry.cpp.
QgsNumericFormat * QgsNumericFormatRegistry::create | ( | const QString & | id, |
const QVariantMap & | configuration, | ||
const QgsReadWriteContext & | context | ||
) | const |
Creates a new numeric format by id, using the supplied configuration.
If there is no such id registered, a default QgsFallbackNumericFormat with a null id will be returned instead.
The caller takes ownership of the returned object.
Definition at line 72 of file qgsnumericformatregistry.cpp.
QgsNumericFormat * QgsNumericFormatRegistry::createFromXml | ( | const QDomElement & | element, |
const QgsReadWriteContext & | context | ||
) | const |
Creates a new numeric format from an XML element.
If there is no matching format ID registered, a default QgsFallbackNumericFormat will be returned instead.
The caller takes ownership of the returned object.
Definition at line 80 of file qgsnumericformatregistry.cpp.
QgsNumericFormat * QgsNumericFormatRegistry::fallbackFormat | ( | ) | const |
Returns a basic numeric formatter which can be used to represent any number in an default manner.
The caller takes ownership of the returned object.
Definition at line 91 of file qgsnumericformatregistry.cpp.
QgsNumericFormat * QgsNumericFormatRegistry::format | ( | const QString & | id | ) | const |
Creates a new numeric format by id.
If there is no such id registered, a default QgsFallbackNumericFormat with a null id will be returned instead.
The caller takes ownership of the returned object.
Definition at line 64 of file qgsnumericformatregistry.cpp.
QStringList QgsNumericFormatRegistry::formats | ( | ) | const |
Returns a list of the format IDs currently contained in the registry.
Definition at line 43 of file qgsnumericformatregistry.cpp.
void QgsNumericFormatRegistry::removeFormat | ( | const QString & | id | ) |
Removes the format with matching id from the registry.
Definition at line 56 of file qgsnumericformatregistry.cpp.
int QgsNumericFormatRegistry::sortKey | ( | const QString & | id | ) | const |
Returns the sorting key for the format with matching id.
Definition at line 104 of file qgsnumericformatregistry.cpp.
QString QgsNumericFormatRegistry::visibleName | ( | const QString & | id | ) | const |
Returns the translated, user-visible name for the format with matching id.
Definition at line 96 of file qgsnumericformatregistry.cpp.