Class: QgsFeatureListView

Shows a list of features and renders an edit button next to each feature.

Accepts a display expression to define the way, features are rendered. Uses a QgsFeatureListModel as source model.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsFeatureListView

Base classes

QListView

QAbstractItemView

QAbstractScrollArea

QFrame

QWidget

QObject

QPaintDevice

class qgis.gui.QgsFeatureListView[source]

Bases: QListView

__init__(parent: QWidget | None = None)

Creates a feature list view

Parameters:

parent (Optional[QWidget] = None) – owner

currentEditSelection(self) Any[source]

Gets the currentEditSelection

Return type:

Any

Returns:

A list of edited feature ids

signal currentEditSelectionChanged[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.

signal currentEditSelectionProgressChanged[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.

displayExpression(self) str[source]

Returns the expression which is currently used to render the features.

Return type:

str

Returns:

A string containing the currend display expression

See also

QgsExpression

signal displayExpressionChanged[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.

editFirstFeature(self)[source]

editFirstFeature will try to edit the first feature of the list

Added in version 3.8.

editLastFeature(self)[source]

editLastFeature will try to edit the last feature of the list

Added in version 3.8.

editNextFeature(self)[source]

editNextFeature will try to edit next feature of the list

Added in version 3.8.

editPreviousFeature(self)[source]

editPreviousFeature will try to edit previous feature of the list

Added in version 3.8.

featureListModel(self) QgsFeatureListModel | None[source]

Gets the featureListModel used by this view

Return type:

Optional[QgsFeatureListModel]

Returns:

The model in use

layerCache(self) QgsVectorLayerCache | None[source]

Returns the layer cache

Return type:

Optional[QgsVectorLayerCache]

Returns:

the layer cache used as backend

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.

repaintRequested(self, indexes: Iterable[QModelIndex])[source]
repaintRequested(self)
Parameters:

indexes (Iterable[QModelIndex])

virtual selectAll(self)[source]

Select all currently visible features

setCurrentFeatureEdited(self, state: bool)[source]

Sets if the currently shown form has received any edit events so far.

Parameters:

state (bool) – The state

setDisplayExpression(self, displayExpression: str | None) bool[source]

The display expression is an expression used to render the fields into a single string which is displaied.

Parameters:

displayExpression (Optional[str]) – The expression used to render the feature

See also

QgsExpression

Return type:

bool

setEditSelection(self, fids: Any)[source]

Set the feature(s) to be edited

Parameters:

fids (Any) – A list of features to be edited

setEditSelection(self, index: QModelIndex, command: Union[QItemSelectionModel.SelectionFlags, QItemSelectionModel.SelectionFlag]) Set the feature(s) to be edited

Parameters:
  • index – The selection to set

  • command – selection update mode

setFeatureSelectionManager(self, featureSelectionManager: QgsIFeatureSelectionManager | None)[source]
setFeatureSelectionManager()
Parameters:

featureSelectionManager (Optional[QgsIFeatureSelectionManager])

virtual setModel(self, featureListModel: QgsFeatureListModel | None)[source]

Set the QgsFeatureListModel which is used to retrieve information

Parameters:

featureListModel (Optional[QgsFeatureListModel]) – The model to use

signal willShowContextMenu[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.