Class: QgsFieldCalculator

A dialog class 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

QgsFieldCalculator

Class Hierarchy

Inheritance diagram of qgis.gui.QgsFieldCalculator

Base classes

QDialog

QWidget

QObject

QPaintDevice

Methods

changedAttributeId

Returns the field index of the field for which new attribute values were calculated.

class qgis.gui.QgsFieldCalculator[source]

Bases: QDialog

changedAttributeId(self) int[source]

Returns the field index of the field for which new attribute values were calculated.

Return type:

int

Returns:

The field index if attribute values were calculated or -1, e.g. in case of geometry changes.