Class: QgsAggregateMappingWidget¶
The QgsAggregateMappingWidget
class creates a mapping for
defining sets of aggregates of fields from a QgsFields
object.
Added in version 3.14.
Class Hierarchy¶
Base classes¶
Base class for any widget that can be shown as a inline panel |
|
Methods
Appends a new field to the model, with an optional source and aggregate |
|
Returns a list of Aggregate objects representing the current status of the underlying mapping model |
|
Returns the underlying mapping model |
|
Moves down currently selected field |
|
Moves up currently selected field |
|
Register an expression context generator class that will be used to retrieve an expression context for the widget. |
|
Removes the currently selected field from the model |
|
Scroll the fields view to index |
|
Returns the selection model |
|
Sets the mapping to show in the model. |
|
Set source fields of the underlying mapping model to sourceFields |
|
Sets a source layer to use when generating expression previews in the widget. |
|
Returns the source layer for use when generating expression previews. |
Signals
Emitted when the aggregates defined in the widget are changed. |
- class qgis.gui.QgsAggregateMappingWidget[source]¶
Bases:
QgsPanelWidget
- __init__(parent: QWidget | None = None, sourceFields: QgsFields = QgsFields())
Constructs a QgsAggregateMappingWidget from a set of
sourceFields
. Aparent
object can also be specified.- Parameters:
parent (Optional[QWidget] = None)
sourceFields (
QgsFields
= QgsFields())
- 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] = '')
- mapping(self) List[QgsAggregateMappingModel.Aggregate] ¶
Returns a list of Aggregate objects representing the current status of the underlying mapping model
- Return type:
- model(self) QgsAggregateMappingModel | None [source]¶
Returns the underlying mapping model
- Return type:
Optional[QgsAggregateMappingModel]
- registerExpressionContextGenerator(self, generator: QgsExpressionContextGenerator | None)[source]¶
Register an expression context
generator
class that will be used to retrieve an expression context for the widget.- Parameters:
generator (Optional[QgsExpressionContextGenerator])
- removeSelectedFields(self) bool [source]¶
Removes the currently selected field from the model
- Return type:
bool
- scrollTo(self, index: QModelIndex)[source]¶
Scroll the fields view to
index
- Parameters:
index (QModelIndex)
- selectionModel(self) QItemSelectionModel | None [source]¶
Returns the selection model
- Return type:
Optional[QItemSelectionModel]
- setMapping(self, mapping: Iterable[QgsAggregateMappingModel.Aggregate])[source]¶
Sets the
mapping
to show in the model.- Parameters:
mapping (Iterable[QgsAggregateMappingModel.Aggregate])
- setSourceFields(self, sourceFields: QgsFields)[source]¶
Set source fields of the underlying mapping model to
sourceFields
- Parameters:
sourceFields (QgsFields)
- setSourceLayer(self, layer: QgsVectorLayer | None)[source]¶
Sets a source
layer
to use when generating expression previews in the widget.Added in version 3.16.
- Parameters:
layer (Optional[QgsVectorLayer])
- sourceLayer(self) QgsVectorLayer | None [source]¶
Returns the source layer for use when generating expression previews.
Returned value may be
None
.Added in version 3.16.
- Return type:
Optional[QgsVectorLayer]