Class: QgsIFeatureSelectionManager

Is an interface class to abstract feature selection handling.

e.g. QgsVectorLayer implements this interface to manage its selections.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: deselect(), select(), selectedFeatureCount(), setSelectedFeatures()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsIFeatureSelectionManager

Base classes

QObject

Abstract Methods

deselect

Deselect features by feature ids.

select

Select features by feature ids.

selectedFeatureCount

Returns the number of features that are selected in this layer.

setSelectedFeatures

Change selection to the new set of features.

Methods

selectedFeatureIds

Returns reference to identifiers of selected features

Signals

selectionChanged

Emitted when selection was changed.

class qgis.gui.QgsIFeatureSelectionManager[source]

Bases: QObject

abstract deselect(self, ids: Any)[source]

Deselect features by feature ids.

Parameters:

ids (Any)

abstract select(self, ids: Any)[source]

Select features by feature ids.

Parameters:

ids (Any)

abstract selectedFeatureCount(self) int[source]

Returns the number of features that are selected in this layer.

Return type:

int

selectedFeatureIds(self) Any

Returns reference to identifiers of selected features

Return type:

Any

Returns:

A list of selected QgsFeatureId

signal selectionChanged(selected: QgsFeatureIds, deselected: QgsFeatureIds, clearAndSelect: bool)[source]

Emitted when selection was changed.

Parameters:
  • selected (QgsFeatureIds) – Newly selected feature ids

  • deselected (QgsFeatureIds) – Ids of all features which have previously been selected but are not any more

  • clearAndSelect (bool) – In case this is set to True, the old selection was dismissed and the new selection corresponds to selected

abstract setSelectedFeatures(self, ids: Any)[source]

Change selection to the new set of features. Dismisses the current selection. Will emit the selectionChanged() signal with the clearAndSelect flag set.

Parameters:

ids (Any) – The ids which will be the new selection