Class: QgsBasicNumericFormat

class qgis.core.QgsBasicNumericFormat

Bases: QgsNumericFormat

A numeric formatter which returns a simple text representation of a value.

Added in version 3.12.

QgsBasicNumericFormat() Default constructor

QgsBasicNumericFormat(a0: QgsBasicNumericFormat)

Methods

clone

rtype:

Optional[QgsNumericFormat]

configuration

param context:

create

param configuration:

decimalSeparator

Returns any override for the decimal separator character.

formatDouble

param value:

id

rtype:

str

numberDecimalPlaces

Returns the maximum number of decimal places to show.

roundingType

Returns the rounding type, which controls the behavior of the numberDecimalPlaces() setting.

setConfiguration

Sets the format's configuration.

setDecimalSeparator

Sets an override character for the decimal separator character.

setNumberDecimalPlaces

Sets the maximum number of decimal places to show.

setRoundingType

Sets the rounding type, which controls the behavior of the numberDecimalPlaces() setting.

setShowPlusSign

Sets whether a leading plus sign will be shown for positive values.

setShowThousandsSeparator

Sets whether the thousands grouping separator will be shown.

setShowTrailingZeros

Sets whether trailing zeros will be shown (up to the specified numberDecimalPlaces()).

setThousandsSeparator

Sets an override character for the thousands separator character.

showPlusSign

Returns True if a leading plus sign will be shown for positive values.

showThousandsSeparator

Returns True if the thousands grouping separator will be shown.

showTrailingZeros

Returns True if trailing zeros will be shown (up to the specified numberDecimalPlaces()).

sortKey

rtype:

int

thousandsSeparator

Returns any override for the thousands separator character.

visibleName

rtype:

str

Attributes

DecimalPlaces

SignificantFigures

DecimalPlaces = 0
class RoundingType

Bases: int

SignificantFigures = 1
clone(self) QgsNumericFormat | None
Return type:

Optional[QgsNumericFormat]

configuration(self, context: QgsReadWriteContext) Dict[str, Any]
Parameters:

context (QgsReadWriteContext)

Return type:

Dict[str, Any]

create(self, configuration: Dict[str, Any], context: QgsReadWriteContext) QgsNumericFormat | None
Parameters:
Return type:

Optional[QgsNumericFormat]

decimalSeparator(self) str

Returns any override for the decimal separator character. If an invalid QChar is returned, then the QGIS locale separator is used instead.

Return type:

str

formatDouble(self, value: float, context: QgsNumericFormatContext) str
Parameters:
Return type:

str

id(self) str
Return type:

str

numberDecimalPlaces(self) int

Returns the maximum number of decimal places to show.

Return type:

int

roundingType(self) QgsBasicNumericFormat.RoundingType

Returns the rounding type, which controls the behavior of the numberDecimalPlaces() setting.

Return type:

QgsBasicNumericFormat.RoundingType

setConfiguration(self, configuration: Dict[str, Any], context: QgsReadWriteContext)

Sets the format’s configuration.

Parameters:
setDecimalSeparator(self, character: str)

Sets an override character for the decimal separator character. If an invalid QChar is set, then the QGIS locale separator is used instead.

Parameters:

character (str)

setNumberDecimalPlaces(self, places: int)

Sets the maximum number of decimal places to show.

Parameters:

places (int)

setRoundingType(self, type: QgsBasicNumericFormat.RoundingType)

Sets the rounding type, which controls the behavior of the numberDecimalPlaces() setting.

See also

roundingType()

Parameters:

type (QgsBasicNumericFormat.RoundingType)

setShowPlusSign(self, show: bool)

Sets whether a leading plus sign will be shown for positive values.

See also

showPlusSign()

Parameters:

show (bool)

setShowThousandsSeparator(self, show: bool)

Sets whether the thousands grouping separator will be shown.

Parameters:

show (bool)

setShowTrailingZeros(self, show: bool)

Sets whether trailing zeros will be shown (up to the specified numberDecimalPlaces()).

Parameters:

show (bool)

setThousandsSeparator(self, character: str)

Sets an override character for the thousands separator character. If an invalid QChar is set, then the QGIS locale separator is used instead.

Parameters:

character (str)

showPlusSign(self) bool

Returns True if a leading plus sign will be shown for positive values.

Return type:

bool

showThousandsSeparator(self) bool

Returns True if the thousands grouping separator will be shown.

Return type:

bool

showTrailingZeros(self) bool

Returns True if trailing zeros will be shown (up to the specified numberDecimalPlaces()).

Return type:

bool

sortKey(self) int
Return type:

int

thousandsSeparator(self) str

Returns any override for the thousands separator character. If an invalid QChar is returned, then the QGIS locale separator is used instead.

Return type:

str

visibleName(self) str
Return type:

str