QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
|
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 28 of file qgsnumericformatregistry.cpp.
QgsNumericFormatRegistry::~QgsNumericFormatRegistry | ( | ) |
Definition at line 40 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 50 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 74 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 82 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 93 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 66 of file qgsnumericformatregistry.cpp.
QStringList QgsNumericFormatRegistry::formats | ( | ) | const |
Returns a list of the format IDs currently contained in the registry.
Definition at line 45 of file qgsnumericformatregistry.cpp.
void QgsNumericFormatRegistry::removeFormat | ( | const QString & | id | ) |
Removes the format with matching id from the registry.
Definition at line 58 of file qgsnumericformatregistry.cpp.
int QgsNumericFormatRegistry::sortKey | ( | const QString & | id | ) | const |
Returns the sorting key for the format with matching id.
Definition at line 106 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 98 of file qgsnumericformatregistry.cpp.