Class: QgsIFeatureSelectionManager

Is an interface class to abstract feature selection handling.

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

Class Hierarchy

Inheritance diagram of qgis.gui.QgsIFeatureSelectionManager

Base classes

QObject

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.

selectedFeatureIds

Returns reference to identifiers of selected features

setSelectedFeatures

Change selection to the new set of features.

Signals

selectionChanged

Emitted when selection was changed.

class qgis.gui.QgsIFeatureSelectionManager[source]

Bases: QObject

deselect(self, ids: Any)[source]

Deselect features by feature ids.

Parameters:

ids (Any)

select(self, ids: Any)[source]

Select features by feature ids.

Parameters:

ids (Any)

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

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