QGIS API Documentation  3.14.0-Pi (9f7028fd23)
Public Member Functions | List of all members
QgsNumericFormatRegistry Class Reference

#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...
 
QgsNumericFormatcreate (const QString &id, const QVariantMap &configuration, const QgsReadWriteContext &context) const
 Creates a new numeric format by id, using the supplied configuration. More...
 
QgsNumericFormatcreateFromXml (const QDomElement &element, const QgsReadWriteContext &context) const
 Creates a new numeric format from an XML element. More...
 
QgsNumericFormatfallbackFormat () const
 Returns a basic numeric formatter which can be used to represent any number in an default manner. More...
 
QgsNumericFormatformat (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...
 

Detailed Description

The QgsNumericFormatRegistry manages registered classes of QgsNumericFormat.

A reference to the QgsFieldFormatterRegistry can be obtained from QgsApplication::numericFormatRegistry().

Since
QGIS 3.12

Definition at line 38 of file qgsnumericformatregistry.h.

Constructor & Destructor Documentation

◆ QgsNumericFormatRegistry()

QgsNumericFormatRegistry::QgsNumericFormatRegistry ( )
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::~QgsNumericFormatRegistry ( )

Definition at line 38 of file qgsnumericformatregistry.cpp.

Member Function Documentation

◆ addFormat()

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.

◆ create()

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.

◆ createFromXml()

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.

◆ fallbackFormat()

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.

◆ format()

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.

◆ formats()

QStringList QgsNumericFormatRegistry::formats ( ) const

Returns a list of the format IDs currently contained in the registry.

Definition at line 43 of file qgsnumericformatregistry.cpp.

◆ removeFormat()

void QgsNumericFormatRegistry::removeFormat ( const QString &  id)

Removes the format with matching id from the registry.

Definition at line 56 of file qgsnumericformatregistry.cpp.

◆ sortKey()

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.

◆ visibleName()

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.


The documentation for this class was generated from the following files: