Class: QgsValueMapFieldFormatter

class qgis.core.QgsValueMapFieldFormatter

Bases: QgsFieldFormatter

Default constructor of field formatter for a value map field.

QgsValueMapFieldFormatter(QgsValueMapFieldFormatter)

Field formatter for a ValueMap field. A value relation field formatter looks up the values a map.

The map is defined in the configuration as dictionary under the key “map”.

{ “map”: { 1: “one”, 2: “two”, 3: “three” } }

Values that are not on the map will be wrapped in parentheses. So with the above configuration:

  • 3 => “three”

  • 5 => “(5)”

Methods

id

rtype

str

representValue

param layer

sortValue

param layer

Attributes

NULL_VALUE

NULL_VALUE = '{2839923C-8B7D-419E-B84B-CA2FE9B80EC7}'
id(self) → str
Return type

str

representValue(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → str
Parameters
  • layer (QgsVectorLayer) –

  • fieldIndex (int) –

  • config (Dict[str) –

  • cache (Any) –

  • value (Any) –

Return type

str

sortValue(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → Any
Parameters
  • layer (QgsVectorLayer) –

  • fieldIndex (int) –

  • config (Dict[str) –

  • cache (Any) –

  • value (Any) –

Return type

Any