Class: QgsExpressionFieldBuffer

class qgis.core.QgsExpressionFieldBuffer

Bases: sip.wrapper

Constructor for QgsExpressionFieldBuffer.

QgsExpressionFieldBuffer(QgsExpressionFieldBuffer)

Buffers information about expression fields for a vector layer.

New in version 2.6: Enums

Methods

addExpression Add an expression to the buffer
expressions
readXml Reads expressions from project file
removeExpression Remove an expression from the buffer
renameExpression Renames an expression field at a given index
updateExpression Changes the expression at a given index
updateFields Adds fields with the expressions buffered in this object to a QgsFields object
writeXml Saves expressions to xml under the layer node

Signals

Attributes

class ExpressionField(exp: str, fld: QgsField)

Bases: sip.wrapper

QgsExpressionFieldBuffer.ExpressionField(QgsExpressionFieldBuffer.ExpressionField)

cachedExpression
field
addExpression(self, exp: str, fld: QgsField)

Add an expression to the buffer

Parameters:
  • exp – expression to add
  • fld – field to add
expressions(self) → object
readXml(self, layer_node: QDomNode)

Reads expressions from project file

removeExpression(self, index: int)

Remove an expression from the buffer

Parameters:index – index of expression to remove
renameExpression(self, index: int, name: str)

Renames an expression field at a given index

Parameters:
  • index – The index of the expression to change
  • name – New name for field

New in version 3.0.

updateExpression(self, index: int, exp: str)

Changes the expression at a given index

Parameters:
  • index – The index of the expression to change
  • exp – The new expression to set

New in version 2.9.

updateFields(self, flds: QgsFields)

Adds fields with the expressions buffered in this object to a QgsFields object

Parameters:flds – The fields to be updated
writeXml(self, layer_node: QDomNode, document: QDomDocument)

Saves expressions to xml under the layer node