Subgroup: Value

Class: QgsValueMapFieldFormatter

class qgis.core.QgsValueMapFieldFormatter

Bases: qgis._core.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)”

New in version 3.0: Methods

id
representValue
sortValue

Signals

Attributes

NULL_VALUE
NULL_VALUE = '{2839923C-8B7D-419E-B84B-CA2FE9B80EC7}'
id(self) → str
representValue(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → str
sortValue(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → Any