QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsNumericFormatRegistry Class Reference

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

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 29 of file qgsnumericformatregistry.cpp.

◆ ~QgsNumericFormatRegistry()

QgsNumericFormatRegistry::~QgsNumericFormatRegistry ( )

Definition at line 42 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 52 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 76 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 84 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 95 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 68 of file qgsnumericformatregistry.cpp.

◆ formats()

QStringList QgsNumericFormatRegistry::formats ( ) const

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

Definition at line 47 of file qgsnumericformatregistry.cpp.

◆ removeFormat()

void QgsNumericFormatRegistry::removeFormat ( const QString &  id)

Removes the format with matching id from the registry.

Definition at line 60 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 108 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 100 of file qgsnumericformatregistry.cpp.


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