Class: QgsValueRelationFieldFormatter¶
-
class
qgis.core.
QgsValueRelationFieldFormatter
¶ Bases:
qgis._core.QgsFieldFormatter
Constructor for QgsValueRelationFieldFormatter.
QgsValueRelationFieldFormatter(QgsValueRelationFieldFormatter)
Field formatter for a value relation field. A value relation field formatter looks up the values from features on another layer.
New in version 3.0: Enums
Methods
createCache(config: Dict[str, Any], formFeature: QgsFeature = QgsFeature()) -> List[QgsValueRelationFieldFormatter.ValueRelationItem] Create a cache for a value relation field.
Returns a list of attributes required by the form context
expression
Returns a list of variables required by the form context
expression
Check whether the
feature
has all values required by theexpression
Check if the
expression
requires a form scope (i.e.Returns the (possibly NULL) layer from the widget’s
config
andproject
Utility to convert a list or a string representation of an (hstore style: {1,2…}) list in
value
to a string listSignals
Attributes
-
class
ValueRelationItem
(key: Any, value: str)¶ Bases:
sip.wrapper
Constructor for ValueRelationItem
QgsValueRelationFieldFormatter.ValueRelationItem() Constructor for ValueRelationItem
QgsValueRelationFieldFormatter.ValueRelationItem(QgsValueRelationFieldFormatter.ValueRelationItem)
-
key
¶
-
value
¶
-
-
createCache
(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any]) → Any¶ createCache(config: Dict[str, Any], formFeature: QgsFeature = QgsFeature()) -> List[QgsValueRelationFieldFormatter.ValueRelationItem] Create a cache for a value relation field. This can be used to keep the value map in the local memory if doing multiple lookups in a loop.
- Parameters
config – The widget configuration
formFeature – The feature currently being edited with current attribute values
- Returns
A kvp list of values for the widget
New in version 3.0.
-
expressionFormAttributes
(expression: str) → Set[str]¶ Returns a list of attributes required by the form context
expression
- Parameters
expression – Form filter expression
- Returns
list of attributes required by the expression
New in version 3.2.
-
expressionFormVariables
(expression: str) → Set[str]¶ Returns a list of variables required by the form context
expression
- Parameters
expression – Form filter expression
- Returns
list of variables required by the expression
New in version 3.2.
-
expressionIsUsable
(expression: str, feature: QgsFeature) → bool¶ Check whether the
feature
has all values required by theexpression
- Returns
True
if the expression can be used
New in version 3.2.
-
expressionRequiresFormScope
(expression: str) → bool¶ Check if the
expression
requires a form scope (i.e. if it uses fields or geometry of the currently edited feature).- Parameters
expression – The widget’s filter expression
- Returns
True
if the expression requires a form scope
New in version 3.2.
-
id
(self) → str¶
-
representValue
(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → str¶
-
resolveLayer
(config: Dict[str, Any], project: QgsProject) → QgsVectorLayer¶ Returns the (possibly NULL) layer from the widget’s
config
andproject
New in version 3.8.
-
sortValue
(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → Any¶
-
valueToStringList
(value: Any) → List[str]¶ Utility to convert a list or a string representation of an (hstore style: {1,2…}) list in
value
to a string listNew in version 3.2.
-
class