Class: QgsAggregateMappingModel

class qgis.gui.QgsAggregateMappingModel(sourceFields: QgsFields = QgsFields(), parent: QObject = None)

Bases: PyQt5.QtCore.QAbstractTableModel

Constructs a QgsAggregateMappingModel from a set of sourceFields. A parent object can be also specified.

The QgsAggregateMappingModel holds mapping information for defining sets of aggregates of fields from a QgsFields object.

New in version 3.14: Enums

ColumnDataIndex

Bases: enum.IntEnum

Methods

appendField

Appends a new field to the model, with an optional source and aggregate

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

columnCount

param parent

connectNotify

contextGenerator

Returns the context generator with the source fields

createIndex

customEvent

data

param index

decodeData

disconnectNotify

encodeData

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

flags

param index

headerData

param section

isSignalConnected

mapping

Returns a list of Aggregate objects representing the current status of the model

moveDown

Moves up the field at index

moveUp

Moves down the field at index

persistentIndexList

receivers

removeField

Removes the field at index from the model, returns True on success

resetInternalData

rowCount

param parent

sender

senderSignalIndex

setBaseExpressionContextGenerator

Sets the base expression context generator, which will generate the expression contexts for expression based widgets used by the model.

setData

param index

setMapping

Sets the mapping to show in the model.

setSourceFields

Set source fields to sourceFields

sourceFields

Returns a list of source fields

timerEvent

class Aggregate
class Aggregate(QgsAggregateMappingModel.Aggregate)None

Bases: sip.wrapper

aggregate
delimiter
field
source
class ColumnDataIndex(value)

Bases: enum.IntEnum

The ColumnDataIndex enum represents the column index for the view

  • SourceExpression: Expression

  • Aggregate: Aggregate name

  • Delimiter: Delimiter

  • DestinationName: Destination field name

  • DestinationType: Destination field QVariant::Type casted to (int)

  • DestinationLength: Destination field length

  • DestinationPrecision: Destination field precision

Aggregate = 1
Delimiter = 2
DestinationLength = 5
DestinationName = 3
DestinationPrecision = 6
DestinationType = 4
SourceExpression = 0
baseClass

alias of qgis._gui.QgsAggregateMappingModel

appendField(self, field: QgsField, source: str = '', aggregate: str = '')

Appends a new field to the model, with an optional source and aggregate

Parameters
  • field (QgsField) –

  • source (str = '') –

  • aggregate (str = '') –

QgsAggregateMappingModel.beginInsertColumns(self, QModelIndex, int, int)
QgsAggregateMappingModel.beginInsertRows(self, QModelIndex, int, int)
QgsAggregateMappingModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsAggregateMappingModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsAggregateMappingModel.beginRemoveColumns(self, QModelIndex, int, int)
QgsAggregateMappingModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
QgsAggregateMappingModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
childEvent(self, QChildEvent)
columnCount(self, parent: QModelIndex = QModelIndex())int
Parameters

parent (QModelIndex = QModelIndex()) –

Return type

int

connectNotify(self, QMetaMethod)
contextGenerator(self)QgsExpressionContextGenerator

Returns the context generator with the source fields

Return type

QgsExpressionContextGenerator

QgsAggregateMappingModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
data(self, index: QModelIndex, role: int)Any
Parameters
  • index (QModelIndex) –

  • role (int) –

Return type

Any

QgsAggregateMappingModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
disconnectNotify(self, QMetaMethod)
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
flags(self, index: QModelIndex)Qt.ItemFlags
Parameters

index (QModelIndex) –

Return type

Qt.ItemFlags

headerData(self, section: int, orientation: Qt.Orientation, role: int)Any
Parameters
  • section (int) –

  • orientation (Qt.Orientation) –

  • role (int) –

Return type

Any

isSignalConnected(self, QMetaMethod)bool
mapping(self)List[QgsAggregateMappingModel.Aggregate]

Returns a list of Aggregate objects representing the current status of the model

Return type

List[QgsAggregateMappingModel.Aggregate]

moveDown(self, index: QModelIndex)bool

Moves up the field at index

Parameters

index (QModelIndex) –

Return type

bool

moveUp(self, index: QModelIndex)bool

Moves down the field at index

Parameters

index (QModelIndex) –

Return type

bool

persistentIndexList(self)List[QModelIndex]
receivers(self, PYQT_SIGNAL)int
removeField(self, index: QModelIndex)bool

Removes the field at index from the model, returns True on success

Parameters

index (QModelIndex) –

Return type

bool

resetInternalData(self)
rowCount(self, parent: QModelIndex = QModelIndex())int
Parameters

parent (QModelIndex = QModelIndex()) –

Return type

int

sender(self)QObject
senderSignalIndex(self)int
setBaseExpressionContextGenerator(self, generator: QgsExpressionContextGenerator)

Sets the base expression context generator, which will generate the expression contexts for expression based widgets used by the model.

Parameters

generator (QgsExpressionContextGenerator) –

setData(self, index: QModelIndex, value: Any, role: int)bool
Parameters
  • index (QModelIndex) –

  • value (Any) –

  • role (int) –

Return type

bool

setMapping(self, mapping: Iterable[QgsAggregateMappingModel.Aggregate])

Sets the mapping to show in the model.

Parameters

mapping (Iterable[QgsAggregateMappingModel.Aggregate]) –

setSourceFields(self, sourceFields: QgsFields)

Set source fields to sourceFields

Parameters

sourceFields (QgsFields) –

sourceFields(self)QgsFields

Returns a list of source fields

Return type

QgsFields

timerEvent(self, QTimerEvent)