Class: QgsAggregateMappingWidget¶
A widget which 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 an inline panel. |
|
- class qgis.gui.QgsAggregateMappingWidget[source]¶
Bases:
QgsPanelWidget- __init__(parent: QWidget | None = None, sourceFields: QgsFields = QgsFields())
Constructs a QgsAggregateMappingWidget from a set of
sourceFields. Aparentobject 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
fieldto the model, with an optionalsourceandaggregate- Parameters:
field (QgsField)
source (Optional[str] = '')
aggregate (Optional[str] = '')
- signal changed[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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
generatorclass 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
mappingto 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
layerto 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]