QgsFieldFormatterRegistry class

The QgsFieldFormatterRegistry manages registered classes of QgsFieldFormatter.

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

Constructors, destructors, conversion operators

QgsFieldFormatterRegistry(QObject* parent = nullptr) explicit
You should not normally need to create your own field formatter registry.

Public functions

void addFieldFormatter(QgsFieldFormatter* formatter)
They will take precedence in order of adding them.
auto fallbackFieldFormatter() const -> QgsFieldFormatter*
Returns a basic fallback field formatter which can be used to represent any field in an unspectacular manner.
auto fieldFormatter(const QString& id) const -> QgsFieldFormatter*
Gets a field formatter by its id.
void removeFieldFormatter(QgsFieldFormatter* formatter)
Remove a field formatter from the registry.
void removeFieldFormatter(const QString& id)
Remove the field formatter with the specified id.

Signals

void fieldFormatterAdded(QgsFieldFormatter* formatter)
Will be emitted after a new field formatter has been added.
void fieldFormatterRemoved(QgsFieldFormatter* formatter)
Will be emitted just before a field formatter is removed and deleted.

Function documentation

QgsFieldFormatterRegistry::QgsFieldFormatterRegistry(QObject* parent = nullptr) explicit

You should not normally need to create your own field formatter registry.

Use the one provided by QgsApplication::fieldFormatterRegistry() instead.

void QgsFieldFormatterRegistry::addFieldFormatter(QgsFieldFormatter* formatter)

They will take precedence in order of adding them.

The later they are added, the more weight they have.

Ownership is transferred to the registry.

QgsFieldFormatter* QgsFieldFormatterRegistry::fieldFormatter(const QString& id) const

Gets a field formatter by its id.

If there is no such id registered, a default QgsFallbackFieldFormatter with a null id will be returned instead.

void QgsFieldFormatterRegistry::removeFieldFormatter(QgsFieldFormatter* formatter)

Remove a field formatter from the registry.

The field formatter will be deleted.