QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
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. | |
~QgsNumericFormatRegistry () | |
void | addFormat (QgsNumericFormat *format) |
Adds a new format to the registry. | |
QgsNumericFormat * | create (const QString &id, const QVariantMap &configuration, const QgsReadWriteContext &context) const |
Creates a new numeric format by id, using the supplied configuration. | |
QgsNumericFormat * | createFromXml (const QDomElement &element, const QgsReadWriteContext &context) const |
Creates a new numeric format from an XML element. | |
QgsNumericFormat * | fallbackFormat () const |
Returns a basic numeric formatter which can be used to represent any number in an default manner. | |
QgsNumericFormat * | format (const QString &id) const |
Creates a new numeric format by id. | |
QStringList | formats () const |
Returns a list of the format IDs currently contained in the registry. | |
void | removeFormat (const QString &id) |
Removes the format with matching id from the registry. | |
int | sortKey (const QString &id) const |
Returns the sorting key for the format with matching id. | |
QString | visibleName (const QString &id) const |
Returns the translated, user-visible name for the format with matching id. | |
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 29 of file qgsnumericformatregistry.cpp.
QgsNumericFormatRegistry::~QgsNumericFormatRegistry | ( | ) |
Definition at line 42 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 52 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 76 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 84 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 95 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 68 of file qgsnumericformatregistry.cpp.
QStringList QgsNumericFormatRegistry::formats | ( | ) | const |
Returns a list of the format IDs currently contained in the registry.
Definition at line 47 of file qgsnumericformatregistry.cpp.
void QgsNumericFormatRegistry::removeFormat | ( | const QString & | id | ) |
Removes the format with matching id from the registry.
Definition at line 60 of file qgsnumericformatregistry.cpp.
int QgsNumericFormatRegistry::sortKey | ( | const QString & | id | ) | const |
Returns the sorting key for the format with matching id.
Definition at line 108 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 100 of file qgsnumericformatregistry.cpp.