Subgroup: Field
Class: QgsFieldModel¶
-
class
qgis.core.
QgsFieldModel
(parent: QObject = None)¶ Bases:
PyQt5.QtCore.QAbstractItemModel
Constructor for QgsFieldModel - creates a model to display the fields of a given layer.
The QgsFieldModel class is a model to display the list of fields of a layer in widgets. If allowed, expressions might be added to the end of the model. It can be associated with a QgsMapLayerModel to dynamically display a layer and its fields.
New in version 2.3: Methods
allowEmptyFieldName
Returns true if the model allows the empty field (“not set”) choice. allowExpression
Returns true if the model allows custom expressions to be created and displayed. beginInsertColumns
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveRows
beginResetModel
changePersistentIndex
changePersistentIndexList
childEvent
columnCount
connectNotify
createIndex
customEvent
data
decodeData
disconnectNotify
encodeData
endInsertColumns
endInsertRows
endMoveColumns
endMoveRows
endRemoveColumns
endRemoveRows
endResetModel
fieldToolTip
Returns a HTML formatted tooltip string for a field
, containing details like the field name, alias and type.index
indexFromName
Returns the index corresponding to a given fieldName. isField
Returns true if a string represents a field reference, or false if it is an expression consisting of more than direct field reference. isSignalConnected
layer
Returns the layer associated with the model. parent
persistentIndexList
receivers
removeExpression
Removes any custom expression from the model. resetInternalData
rowCount
sender
senderSignalIndex
setAllowEmptyFieldName
Sets whether an optional empty field (“not set”) option is present in the model. setAllowExpression
Sets whether custom expressions are accepted and displayed in the model. setExpression
Sets a single expression to be added after the fields at the end of the model. setLayer
Set the layer from which fields are displayed. timerEvent
updateModel
Called when the model must be updated. Signals
Attributes
ExpressionRole
ExpressionValidityRole
FieldIndexRole
FieldNameRole
FieldOriginRole
FieldTypeRole
IsEmptyRole
IsExpressionRole
-
ExpressionRole
= 259¶
-
ExpressionValidityRole
= 261¶
-
FieldIndexRole
= 258¶
-
FieldNameRole
= 257¶
-
FieldOriginRole
= 263¶
-
class
FieldRoles
¶ Bases:
int
-
FieldTypeRole
= 262¶
-
IsEmptyRole
= 264¶
-
IsExpressionRole
= 260¶
-
allowEmptyFieldName
(self) → bool¶ Returns true if the model allows the empty field (“not set”) choice.
See also
New in version 3.0.
-
allowExpression
(self) → bool¶ Returns true if the model allows custom expressions to be created and displayed.
See also
-
beginInsertColumns
()¶
-
beginInsertRows
()¶
-
beginMoveColumns
()¶
-
beginMoveRows
()¶
-
beginRemoveColumns
()¶
-
beginRemoveRows
()¶
-
beginResetModel
()¶
-
changePersistentIndex
()¶
-
changePersistentIndexList
()¶
-
childEvent
()¶
-
columnCount
(self, parent: QModelIndex) → int¶
-
connectNotify
()¶
-
createIndex
()¶
-
customEvent
()¶
-
data
(self, index: QModelIndex, role: int) → Any¶
-
decodeData
()¶
-
disconnectNotify
()¶
-
encodeData
()¶
-
endInsertColumns
()¶
-
endInsertRows
()¶
-
endMoveColumns
()¶
-
endMoveRows
()¶
-
endRemoveColumns
()¶
-
endRemoveRows
()¶
-
endResetModel
()¶
-
fieldToolTip
(field: QgsField) → str¶ Returns a HTML formatted tooltip string for a
field
, containing details like the field name, alias and type.New in version 3.0.
-
index
(self, row: int, column: int, parent: QModelIndex = QModelIndex()) → QModelIndex¶
-
indexFromName
(self, fieldName: str) → QModelIndex¶ Returns the index corresponding to a given fieldName.
-
isField
(self, expression: str) → bool¶ Returns true if a string represents a field reference, or false if it is an expression consisting of more than direct field reference.
-
isSignalConnected
()¶
-
layer
(self) → QgsVectorLayer¶ Returns the layer associated with the model.
See also
-
parent
(self, child: QModelIndex) → QModelIndex¶
-
persistentIndexList
()¶
-
receivers
()¶
-
removeExpression
(self)¶ Removes any custom expression from the model.
See also
See also
-
resetInternalData
()¶
-
rowCount
(self, parent: QModelIndex = QModelIndex()) → int¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setAllowEmptyFieldName
(self, allowEmpty: bool)¶ Sets whether an optional empty field (“not set”) option is present in the model.
See also
New in version 3.0.
-
setAllowExpression
(self, allowExpression: bool)¶ Sets whether custom expressions are accepted and displayed in the model.
See also
See also
-
setExpression
(self, expression: str)¶ Sets a single expression to be added after the fields at the end of the model.
See also
See also
See also
-
setLayer
(self, layer: QgsVectorLayer)¶ Set the layer from which fields are displayed.
See also
-
timerEvent
()¶
-
updateModel
(self)¶ Called when the model must be updated.
-