Class: QgsFieldMappingWidget

class qgis.gui.QgsFieldMappingWidget(parent: QWidget = None, sourceFields: QgsFields = QgsFields(), destinationFields: QgsFields = QgsFields(), expressions: Dict[str, str] = {})

Bases: QgsPanelWidget

Constructs a QgsFieldMappingWidget from a set of sourceFields and destinationFields, initial values for the expressions can be optionally specified through expressions which is a map from the original field name to the corresponding expression. A parent object can also be specified.

The QgsFieldMappingWidget class creates a mapping from one set of QgsFields to another, for each set of “destination” fields an expression defines how to obtain the values of the “destination” fields.

New in version 3.14.

Parameters
  • parent (QWidget = None) –

  • sourceFields (QgsFields = QgsFields()) –

  • destinationFields (QgsFields = QgsFields()) –

  • expressions

actionEvent()
appendField(self, field: QgsField, expression: str = '')

Appends a new field to the model, with an optional expression

Parameters
  • field (QgsField) –

  • expression (str = '') –

changeEvent()
childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
create()
customEvent()
destinationEditable(self) → bool

Returns True if the destination fields are editable in the model

Return type

bool

destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
fieldPropertyMap(self) → Dict[str, QgsProperty]

Returns a map of destination field name to QgsProperty definition for field value, representing the current status of the widget.

Return type

Dict[str, QgsProperty]

focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
mapping(self) → List[QgsFieldMappingModel.Field]

Returns a list of Field objects representing the current status of the underlying mapping model

Return type

List[QgsFieldMappingModel.Field]

metric()
model(self)QgsFieldMappingModel

Returns the underlying mapping model

Return type

QgsFieldMappingModel

mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
moveSelectedFieldsDown(self) → bool

Moves up the currently selected field

Return type

bool

moveSelectedFieldsUp(self) → bool

Moves down currently selected field

Return type

bool

nativeEvent()
paintEvent()
receivers()
removeSelectedFields(self) → bool

Removes the currently selected field from the model

Return type

bool

resizeEvent()
scrollTo(self, index: QModelIndex)

Scroll the fields view to index

Parameters

index (QModelIndex) –

selectionModel(self) → QItemSelectionModel

Returns the selection model

Return type

QItemSelectionModel

sender()
senderSignalIndex()
setDestinationEditable(self, editable: bool)

Sets the destination fields editable state to editable

Parameters

editable (bool) –

setDestinationFields(self, destinationFields: QgsFields, expressions: Dict[str, str] = {})

Set destination fields to destinationFields in the underlying model, initial values for the expressions can be optionally specified through expressions which is a map from the original field name to the corresponding expression.

Parameters
  • destinationFields (QgsFields) –

  • expressions (Dict[str) –

setFieldPropertyMap(self, map: Dict[str, QgsProperty])

Sets a map of destination field name to QgsProperty definition for field value.

Parameters

map (Dict[str) –

setSourceFields(self, sourceFields: QgsFields)

Set source fields of the underlying mapping model to sourceFields

Parameters

sourceFields (QgsFields) –

sharedPainter()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()