Class: QgsFeatureListModel¶
A proxy model for feature lists.
Class Hierarchy¶
Base classes¶
Base class for feature models. |
Methods
Returns the model index corresponding to a feature ID. |
|
Returns the feature ID corresponding to an index from the model. |
|
Returns the current state of null value injection |
|
Returns the vector layer cache which is being used to populate the model. |
|
Does nothing except for calling |
|
Does nothing except for calling |
|
Does nothing except for calling |
|
Does nothing except for calling |
|
Returns a detailed message about errors while parsing a |
|
Sets the display expression. |
|
If |
|
Sort this model by its display expression. |
|
Sort this model by its display expression. |
Virtual Methods
In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsFeatureListModel. See the FAQ for more details.
Attributes
- class qgis.gui.QgsFeatureListModel[source]¶
Bases:
QSortFilterProxyModel,QgsFeatureModel- __init__(sourceModel: QgsAttributeTableFilterModel | None, parent: QObject | None = None)
Constructor for QgsFeatureListModel
- Parameters:
sourceModel (Optional[QgsAttributeTableFilterModel])
parent (Optional[QObject] = None)
- class FeatureInfo¶
- class FeatureInfo(a0: QgsFeatureListModel.FeatureInfo)
Bases:
object- isEdited: bool¶
True if feature has been edited.
- isNew: bool¶
True if feature is a newly added feature.
- FeatureInfoRole = 4096¶
- FeatureRole = 4097¶
- FeatureWithGeometryRole = 4098¶
- class Role¶
Bases:
int
- featureByIndex(self, index: QModelIndex, feat: QgsFeature) bool[source]¶
- Parameters:
index (QModelIndex)
feat (QgsFeature)
- Return type:
bool
- fidToIdx(self, fid: int) QModelIndex[source]¶
Returns the model index corresponding to a feature ID.
See also
- Parameters:
fid (int)
- Return type:
QModelIndex
- fidToIndexList(self, fid: int) List[QModelIndex][source]¶
- Parameters:
fid (int)
- Return type:
List[QModelIndex]
- idxToFid(self, index: QModelIndex) int[source]¶
Returns the feature ID corresponding to an
indexfrom the model.See also
- Parameters:
index (QModelIndex)
- Return type:
int
- injectNull(self) bool[source]¶
Returns the current state of null value injection
- Return type:
bool
- Returns:
If a NULL value is added
- layerCache(self) QgsVectorLayerCache | None[source]¶
Returns the vector layer cache which is being used to populate the model.
- Return type:
Optional[QgsVectorLayerCache]
- virtual mapFromMaster(self, sourceIndex: QModelIndex) QModelIndex[source]¶
- Parameters:
sourceIndex (QModelIndex)
- Return type:
QModelIndex
- virtual mapSelectionFromMaster(self, selection: QItemSelection) QItemSelection[source]¶
- Parameters:
selection (QItemSelection)
- Return type:
QItemSelection
- virtual mapSelectionToMaster(self, selection: QItemSelection) QItemSelection[source]¶
- Parameters:
selection (QItemSelection)
- Return type:
QItemSelection
- virtual mapToMaster(self, proxyIndex: QModelIndex) QModelIndex[source]¶
- Parameters:
proxyIndex (QModelIndex)
- Return type:
QModelIndex
- masterModel(self) QgsAttributeTableModel | None[source]¶
- Return type:
Optional[QgsAttributeTableModel]
- onBeginInsertRows(self, parent: QModelIndex, first: int, last: int)[source]¶
Does nothing except for calling
beginInsertRows()Deprecated since version 3.40: Use
beginInsertRows()instead.- Parameters:
parent (QModelIndex)
first (int)
last (int)
- onBeginRemoveRows(self, parent: QModelIndex, first: int, last: int)[source]¶
Does nothing except for calling
beginRemoveRows()Deprecated since version 3.40: Use
beginRemoveRows()instead.- Parameters:
parent (QModelIndex)
first (int)
last (int)
- onEndInsertRows(self, parent: QModelIndex, first: int, last: int)[source]¶
Does nothing except for calling
endInsertRows()Deprecated since version 3.40: Use
endInsertRows()instead.- Parameters:
parent (QModelIndex)
first (int)
last (int)
- onEndRemoveRows(self, parent: QModelIndex, first: int, last: int)[source]¶
Does nothing except for calling
endRemoveRows()Deprecated since version 3.40: Use
endRemoveRows()instead.- Parameters:
parent (QModelIndex)
first (int)
last (int)
- parserErrorString(self) str[source]¶
Returns a detailed message about errors while parsing a
QgsExpression.- Return type:
str
- Returns:
A message containing information about the parser error.
- setDisplayExpression(self, expression: str | None) bool[source]¶
Sets the display expression.
- Parameters:
expression (Optional[str]) – A
QgsExpressioncompatible string.- Return type:
bool
- Returns:
Trueif the expression could be set,Falseif there was a parse error. If it fails, the old expression will still be applied. CallparserErrorString()for a meaningful error message.
- setInjectNull(self, injectNull: bool)[source]¶
If
Trueis specified, a NULL value will be injected- Parameters:
injectNull (bool) – state of null value injection
Note
If set to
True, the sort by display expression cannot be used
- setSortByDisplayExpression(self, sortByDisplayExpression: bool, order: Qt.SortOrder = Qt.AscendingOrder)[source]¶
Sort this model by its display expression.
Note
Not compatible with injectNull, if sorting by display expression is enabled, injectNull will automatically turned off.
Added in version 3.2.
- Parameters:
sortByDisplayExpression (bool)
order (Qt.SortOrder = Qt.AscendingOrder)