Class: QgsFieldCalculator¶
A dialog that provides calculation of new fields using existing fields, values and a set of operators.
Sample usage of the QgsFieldCalculator class:
uri = "point?crs=epsg:4326&field=id:integer"
layer = QgsVectorLayer(uri, "Scratch point layer", "memory")
layer.startEditing()
dialog = QgsFieldCalculator(layer)
dialog.exec()
QgsFieldCalculator¶
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Methods
Returns the field index of the field for which new attribute values were calculated. |
- class qgis.gui.QgsFieldCalculator[source]¶
Bases:
QDialog- __init__(vl: QgsVectorLayer | None, parent: QWidget | None = None, fieldIndex: int = -1)
Constructor for QgsFieldCalculator, with the specified
parentwidget.The target layer must be specified using the
vlargument.Since QGIS 4.2, the optional
fieldIndexargument can be used to automatically select the existing field with the specified index in the dialog.- Parameters:
vl (Optional[QgsVectorLayer])
parent (Optional[QWidget] = None)
fieldIndex (int = -1)