Subgroup: Value
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: Methods
createCache
createCache(config: Dict[str, Any], formFeature: QgsFeature = QgsFeature()) -> object Create a cache for a value relation field. expressionFormAttributes
Returns a list of attributes required by the form context expression
expressionFormVariables
Returns a list of variables required by the form context expression
expressionIsUsable
Check whether the feature
has all values required by theexpression
expressionRequiresFormScope
Check if the expression
requires a form scope (i.e.id
representValue
sortValue
valueToStringList
Utility to convert an array or a string representation of an array 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()) -> object 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¶
-
sortValue
(self, layer: QgsVectorLayer, fieldIndex: int, config: Dict[str, Any], cache: Any, value: Any) → Any¶
-
valueToStringList
(value: Any) → List[str]¶ Utility to convert an array or a string representation of an array
value
to a string listNew in version 3.2.
-
class