QgsFeatureListView class

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

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

Constructors, destructors, conversion operators

QgsFeatureListView(QWidget* parent = nullptr) explicit
Creates a feature list view.

Public functions

auto currentEditSelection() -> QgsFeatureIds
Gets the currentEditSelection.
auto displayExpression() const -> const QString
Returns the expression which is currently used to render the features.
auto featureListModel() -> QgsFeatureListModel*
Gets the featureListModel used by this view.
auto layerCache() -> QgsVectorLayerCache*
Returns the layer cache.
auto parserErrorString() -> QString
Returns a detailed message about errors while parsing a QgsExpression.
void setCurrentFeatureEdited(bool state)
Sets if the currently shown form has received any edit events so far.
auto setDisplayExpression(const QString& displayExpression) -> bool
The display expression is an expression used to render the fields into a single string which is displaied.
void setFeatureSelectionManager(QgsIFeatureSelectionManager* featureSelectionManager)
setFeatureSelectionManager
void setModel(QgsFeatureListModel* featureListModel) virtual
Set the QgsFeatureListModel which is used to retrieve information.

Signals

void aboutToChangeEditSelection(bool& ok)
void currentEditSelectionChanged(QgsFeature& feat)
Is emitted, whenever the current edit selection has been changed.
void displayExpressionChanged(const QString& expression)
Is emitted, whenever the display expression is successfully changed.
void willShowContextMenu(QgsActionMenu* menu, const QModelIndex& atIndex)
Is emitted, when the context menu is created to add the specific actions to it.

Public slots

void selectAll() override
Select all currently visible features.
void setEditSelection(const QgsFeatureIds& fids)
Set the feature(s) to be edited.
void setEditSelection(const QModelIndex& index, QItemSelectionModel::SelectionFlags command)
Set the feature(s) to be edited.

Function documentation

QgsFeatureListView::QgsFeatureListView(QWidget* parent = nullptr) explicit

Creates a feature list view.

Parameters
parent owner

QgsFeatureIds QgsFeatureListView::currentEditSelection()

Gets the currentEditSelection.

Returns A list of edited feature ids

const QString QgsFeatureListView::displayExpression() const

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

Returns A string containing the currend display expression

QgsFeatureListModel* QgsFeatureListView::featureListModel()

Gets the featureListModel used by this view.

Returns The model in use

QgsVectorLayerCache* QgsFeatureListView::layerCache()

Returns the layer cache.

Returns the layer cache used as backend

QString QgsFeatureListView::parserErrorString()

Returns a detailed message about errors while parsing a QgsExpression.

Returns A message containing information about the parser error.

void QgsFeatureListView::setCurrentFeatureEdited(bool state)

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

Parameters
state The state

bool QgsFeatureListView::setDisplayExpression(const QString& displayExpression)

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

Parameters
displayExpression The expression used to render the feature

void QgsFeatureListView::setFeatureSelectionManager(QgsIFeatureSelectionManager* featureSelectionManager)

setFeatureSelectionManager

Parameters
featureSelectionManager We will take ownership

void QgsFeatureListView::setModel(QgsFeatureListModel* featureListModel) virtual

Set the QgsFeatureListModel which is used to retrieve information.

Parameters
featureListModel The model to use

void QgsFeatureListView::aboutToChangeEditSelection(bool& ok) signal

void QgsFeatureListView::currentEditSelectionChanged(QgsFeature& feat) signal

Is emitted, whenever the current edit selection has been changed.

Parameters
feat the feature, which will be edited.

void QgsFeatureListView::displayExpressionChanged(const QString& expression) signal

Is emitted, whenever the display expression is successfully changed.

Parameters
expression The expression that was applied

void QgsFeatureListView::willShowContextMenu(QgsActionMenu* menu, const QModelIndex& atIndex) signal

Is emitted, when the context menu is created to add the specific actions to it.

Parameters
menu is the already created context menu
atIndex is the position of the current feature in the model

void QgsFeatureListView::setEditSelection(const QgsFeatureIds& fids) public slot

Set the feature(s) to be edited.

Parameters
fids A list of features to be edited

void QgsFeatureListView::setEditSelection(const QModelIndex& index, QItemSelectionModel::SelectionFlags command) public slot

Set the feature(s) to be edited.

Parameters
index The selection to set
command selection update mode