Class: QgsAggregateMappingModel¶
The QgsAggregateMappingModel
holds mapping information for
defining sets of aggregates of fields from a QgsFields
object.
Added in version 3.14.
Class Hierarchy¶
Base classes¶
Enums
The ColumnDataIndex enum represents the column index for the view |
Methods
Appends a new field to the model, with an optional source and aggregate |
|
Returns the context generator with the source fields |
|
Returns a list of Aggregate objects representing the current status of the model |
|
Moves up the field at index |
|
Moves down the field at index |
|
Removes the field at index from the model, returns |
|
Sets the base expression context generator, which will generate the expression contexts for expression based widgets used by the model. |
|
Sets the mapping to show in the model. |
|
Set source fields to sourceFields |
|
Returns a list of source fields |
- class qgis.gui.QgsAggregateMappingModel[source]¶
Bases:
QAbstractTableModel
- __init__(sourceFields: QgsFields = QgsFields(), parent: QObject | None = None)
Constructs a QgsAggregateMappingModel from a set of
sourceFields
. Aparent
object can be also specified.- Parameters:
sourceFields (
QgsFields
= QgsFields())parent (Optional[QObject] = None)
- class Aggregate¶
Bases:
object
The Aggregate struct holds information about an aggregate column
- aggregate¶
Aggregate name
- delimiter¶
Delimiter string
- field¶
The field in its current status (it might have been renamed)
- source¶
The source expression used as the input for the aggregate calculation
- class ColumnDataIndex(*values)¶
Bases:
IntEnum
The ColumnDataIndex enum represents the column index for the view
SourceExpression
: ExpressionAggregate
: Aggregate nameDelimiter
: DelimiterDestinationName
: Destination field nameDestinationType
: Destination field type stringDestinationLength
: Destination field lengthDestinationPrecision
: Destination field precision
- Aggregate = 1¶
- Delimiter = 2¶
- DestinationLength = 5¶
- DestinationName = 3¶
- DestinationPrecision = 6¶
- DestinationType = 4¶
- SourceExpression = 0¶
- appendField(self, field: QgsField, source: str | None = '', aggregate: str | None = '')[source]¶
Appends a new
field
to the model, with an optionalsource
andaggregate
- Parameters:
field (QgsField)
source (Optional[str] = '')
aggregate (Optional[str] = '')
- contextGenerator(self) QgsExpressionContextGenerator | None [source]¶
Returns the context generator with the source fields
- Return type:
Optional[QgsExpressionContextGenerator]
- mapping(self) List[QgsAggregateMappingModel.Aggregate] ¶
Returns a list of Aggregate objects representing the current status of the model
- Return type:
- moveDown(self, index: QModelIndex) bool [source]¶
Moves up the field at
index
- Parameters:
index (QModelIndex)
- Return type:
bool
- moveUp(self, index: QModelIndex) bool [source]¶
Moves down the field at
index
- Parameters:
index (QModelIndex)
- Return type:
bool
- removeField(self, index: QModelIndex) bool [source]¶
Removes the field at
index
from the model, returnsTrue
on success- Parameters:
index (QModelIndex)
- Return type:
bool
- setBaseExpressionContextGenerator(self, generator: QgsExpressionContextGenerator | None)[source]¶
Sets the base expression context
generator
, which will generate the expression contexts for expression based widgets used by the model.- Parameters:
generator (Optional[QgsExpressionContextGenerator])
- setMapping(self, mapping: Iterable[QgsAggregateMappingModel.Aggregate])[source]¶
Sets the
mapping
to show in the model.- Parameters:
mapping (Iterable[QgsAggregateMappingModel.Aggregate])