Class: QgsFieldMappingModel¶
-
class
qgis.gui.
QgsFieldMappingModel
(sourceFields: QgsFields = QgsFields(), destinationFields: QgsFields = QgsFields(), expressions: Dict[str, str] = {}, parent: QObject = None)¶ Bases:
PyQt5.QtCore.QAbstractTableModel
Constructs a
QgsFieldMappingModel
from a set ofsourceFields
anddestinationFields
, initial values for the expressions can be optionally specified throughexpressions
which is a map from the original field name to the corresponding expression. Aparent
object can be also specified.The
QgsFieldMappingModel
holds mapping information for mapping from one set ofQgsFields
to another, for each set of “destination” fields an expression defines how to obtain the values of the “destination” fields. The model can be optionally set “editable” allowing to modify all the fields, by default only the mapping expression is editable.New in version 3.14.
- Parameters
-
class
ColumnDataIndex
(value)¶ Bases:
enum.IntEnum
The ColumnDataIndex enum represents the column index for the view
SourceExpression
: ExpressionDestinationName
: Destination field nameDestinationType
: Destination field QVariant::Type casted to (int)DestinationLength
: Destination field lengthDestinationPrecision
: Destination field precisionDestinationConstraints
: Destination field constraints
-
DestinationConstraints
= 5¶
-
DestinationLength
= 3¶
-
DestinationName
= 1¶
-
DestinationPrecision
= 4¶
-
DestinationType
= 2¶
-
SourceExpression
= 0¶
-
baseClass
¶ alias of
QgsFieldMappingModel
-
class
Field
¶ Bases:
sip.wrapper
QgsFieldMappingModel.Field(QgsFieldMappingModel.Field)
-
expression
¶
-
field
¶
-
originalName
¶
-
-
appendField
(self, field: QgsField, expression: str = '')¶ Appends a new
field
to the model, with an optionalexpression
- Parameters
field (QgsField) –
expression (str = '') –
-
QgsFieldMappingModel.beginInsertColumns(self, QModelIndex, int, int)
-
QgsFieldMappingModel.beginInsertRows(self, QModelIndex, int, int)
-
QgsFieldMappingModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
-
QgsFieldMappingModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
-
QgsFieldMappingModel.beginRemoveColumns(self, QModelIndex, int, int)
-
QgsFieldMappingModel.beginRemoveRows(self, QModelIndex, int, int)
-
beginResetModel
(self)¶
-
QgsFieldMappingModel.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
-
QgsFieldMappingModel.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
-
dataTypes
() → Dict[QVariant.Type, str]¶ Returns a static map of supported data types
- Return type
Dict[QVariant.Type, str]
-
QgsFieldMappingModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
-
destinationEditable
(self) → bool¶ Returns
True
if the destination fields are editable- Return type
bool
-
disconnectNotify
(self, QMetaMethod)¶
-
encodeData
(self, Iterable[QModelIndex], QDataStream)¶
-
endInsertColumns
(self)¶
-
endInsertRows
(self)¶
-
endMoveColumns
(self)¶
-
endMoveRows
(self)¶
-
endRemoveColumns
(self)¶
-
endRemoveRows
(self)¶
-
endResetModel
(self)¶
-
fieldPropertyMap
(self) → Dict[str, QgsProperty]¶ Returns a map of destination field name to
QgsProperty
definition for field value, representing the current status of the model.See also
- Return type
Dict[str, QgsProperty]
-
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[QgsFieldMappingModel.Field]¶ Returns a list of Field objects representing the current status of the model
- Return type
-
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, returnsTrue
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
-
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
, initial values for the expressions can be optionally specified throughexpressions
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.See also
- Parameters
map (Dict[str) –
-
setSourceFields
(self, sourceFields: QgsFields)¶ Set source fields to
sourceFields
- Parameters
sourceFields (QgsFields) –
-
timerEvent
(self, QTimerEvent)¶