Class: QgsFieldFormatterRegistry

A registry which manages classes of QgsFieldFormatter.

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

Class Hierarchy

Inheritance diagram of qgis.core.QgsFieldFormatterRegistry

Base classes

QObject

class qgis.core.QgsFieldFormatterRegistry[source]

Bases: QObject

__init__(parent: QObject | None = None)

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

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

Parameters:

parent (Optional[QObject] = None)

addFieldFormatter(self, formatter: QgsFieldFormatter | None)[source]

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.

Parameters:

formatter (Optional[QgsFieldFormatter])

fallbackFieldFormatter(self) QgsFieldFormatter | None[source]

Returns a basic fallback field formatter which can be used to represent any field in an unspectacular manner.

Return type:

Optional[QgsFieldFormatter]

fieldFormatter(self, id: str | None) QgsFieldFormatter | None[source]

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.

Parameters:

id (Optional[str])

Return type:

Optional[QgsFieldFormatter]

signal fieldFormatterAdded[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal fieldFormatterRemoved[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

removeFieldFormatter(self, formatter: QgsFieldFormatter | None)[source]

Remove a field formatter from the registry. The field formatter will be deleted.

removeFieldFormatter(self, id: Optional[str]) Remove the field formatter with the specified id.

Parameters:

formatter (Optional[QgsFieldFormatter])