Class: QgsNumericFormatRegistry¶
The QgsNumericFormatRegistry manages registered classes of
QgsNumericFormat.
A reference to the QgsFieldFormatterRegistry can be obtained
from QgsApplication.numericFormatRegistry().
Added in version 3.12.
Methods
Adds a new format to the registry.  | 
|
Creates a new numeric format by id, using the supplied configuration.  | 
|
Creates a new numeric format from an XML element.  | 
|
Returns a basic numeric formatter which can be used to represent any number in an default manner.  | 
|
Creates a new numeric format by id.  | 
|
Returns a list of the format IDs currently contained in the registry.  | 
|
Removes the format with matching id from the registry.  | 
|
Returns the sorting key for the format with matching id.  | 
|
Returns the translated, user-visible name for the format with matching id.  | 
- class qgis.core.QgsNumericFormatRegistry[source]¶
 Bases:
object- __init__()
 You should not normally need to create your own numeric format registry.
Use the one provided by :py:func:`QgsApplication.numericFormatRegistry()` instead.
- __init__(a0: QgsNumericFormatRegistry)
 - Parameters:
 
- addFormat(self, format: QgsNumericFormat | None)[source]¶
 Adds a new
formatto the registry.Ownership is transferred to the registry.
- Parameters:
 format (Optional[QgsNumericFormat])
- create(self, id: str | None, configuration: Dict[str, Any], context: QgsReadWriteContext) QgsNumericFormat | None[source]¶
 Creates a new numeric format by
id, using the suppliedconfiguration. If there is no suchidregistered, a defaultQgsFallbackNumericFormatwith a null id will be returned instead.The caller takes ownership of the returned object.
- Parameters:
 id (Optional[str])
configuration (Dict[str, Any])
context (QgsReadWriteContext)
- Return type:
 Optional[QgsNumericFormat]
- createFromXml(self, element: QDomElement, context: QgsReadWriteContext) QgsNumericFormat | None[source]¶
 Creates a new numeric format from an XML
element. If there is no matching format ID registered, a defaultQgsFallbackNumericFormatwill be returned instead.The caller takes ownership of the returned object.
- Parameters:
 element (QDomElement)
context (QgsReadWriteContext)
- Return type:
 Optional[QgsNumericFormat]
- fallbackFormat(self) QgsNumericFormat | None[source]¶
 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:
 Optional[QgsNumericFormat]
- format(self, id: str | None) QgsNumericFormat | None[source]¶
 Creates a new numeric format by
id. If there is no suchidregistered, a defaultQgsFallbackNumericFormatwith a null id will be returned instead.The caller takes ownership of the returned object.
- Parameters:
 id (Optional[str])
- Return type:
 Optional[QgsNumericFormat]
- formats(self) List[str][source]¶
 Returns a list of the format IDs currently contained in the registry.
- Return type:
 List[str]
- removeFormat(self, id: str | None)[source]¶
 Removes the format with matching
idfrom the registry.- Parameters:
 id (Optional[str])