Class: QgsNumericFormatRegistry

class qgis.core.QgsNumericFormatRegistry

Bases: sip.wrapper

You should not normally need to create your own numeric format registry.

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

QgsNumericFormatRegistry(QgsNumericFormatRegistry)

The QgsNumericFormatRegistry manages registered classes of QgsNumericFormat.

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

Methods

addFormat

Adds a new format to the registry.

create

Creates a new numeric format by id, using the supplied configuration.

createFromXml

Creates a new numeric format from an XML element.

fallbackFormat

Returns a basic numeric formatter which can be used to represent any number in an default manner.

format

Creates a new numeric format by id.

formats

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

removeFormat

Removes the format with matching id from the registry.

sortKey

Returns the sorting key for the format with matching id.

visibleName

Returns the translated, user-visible name for the format with matching id.

addFormat(self, format: QgsNumericFormat)

Adds a new format to the registry.

Ownership is transferred to the registry.

Parameters

format (QgsNumericFormat) –

create(self, id: str, configuration: Dict[str, Any], context: QgsReadWriteContext)QgsNumericFormat

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.

Parameters
Return type

QgsNumericFormat

createFromXml(self, element: QDomElement, context: QgsReadWriteContext)QgsNumericFormat

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.

Parameters
Return type

QgsNumericFormat

fallbackFormat(self)QgsNumericFormat

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.

Return type

QgsNumericFormat

format(self, id: str)QgsNumericFormat

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.

Parameters

id (str) –

Return type

QgsNumericFormat

formats(self)List[str]

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

Return type

List[str]

removeFormat(self, id: str)

Removes the format with matching id from the registry.

Parameters

id (str) –

sortKey(self, id: str)int

Returns the sorting key for the format with matching id.

Parameters

id (str) –

Return type

int

visibleName(self, id: str)str

Returns the translated, user-visible name for the format with matching id.

Parameters

id (str) –

Return type

str