QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
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 28 of file qgsnumericformatregistry.cpp.

◆ ~QgsNumericFormatRegistry()

QgsNumericFormatRegistry::~QgsNumericFormatRegistry ( )

Definition at line 40 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 50 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 74 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 82 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 93 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 66 of file qgsnumericformatregistry.cpp.

◆ formats()

QStringList QgsNumericFormatRegistry::formats ( ) const

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

Definition at line 45 of file qgsnumericformatregistry.cpp.

◆ removeFormat()

void QgsNumericFormatRegistry::removeFormat ( const QString &  id)

Removes the format with matching id from the registry.

Definition at line 58 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 106 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 98 of file qgsnumericformatregistry.cpp.


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