QgsIFeatureSelectionManager class

Is an interface class to abstract feature selection handling.

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

Derived classes

class QgsGenericFeatureSelectionManager
This selection manager synchronizes a local set of selected features with an attribute table.
class QgsVectorLayerSelectionManager

Public functions

void deselect(const QgsFeatureIds& ids) pure virtual
Deselect features by feature ids.
void select(const QgsFeatureIds& ids) pure virtual
Select features by feature ids.
auto selectedFeatureCount() -> int pure virtual
Returns the number of features that are selected in this layer.
auto selectedFeatureIds() const -> const QgsFeatureIds& pure virtual
Returns reference to identifiers of selected features.
void setSelectedFeatures(const QgsFeatureIds& ids) pure virtual
Change selection to the new set of features.

Signals

void selectionChanged(const QgsFeatureIds& selected, const QgsFeatureIds& deselected, bool clearAndSelect)
This signal is emitted when selection was changed.

Function documentation

const QgsFeatureIds& QgsIFeatureSelectionManager::selectedFeatureIds() const pure virtual

Returns reference to identifiers of selected features.

Returns A list of QgsFeatureId's

void QgsIFeatureSelectionManager::setSelectedFeatures(const QgsFeatureIds& ids) pure virtual

Change selection to the new set of features.

Parameters
ids The ids which will be the new selection

Dismisses the current selection. Will emit the selectionChanged( const QgsFeatureIds&, const QgsFeatureIds&, bool ) signal with the clearAndSelect flag set.

void QgsIFeatureSelectionManager::selectionChanged(const QgsFeatureIds& selected, const QgsFeatureIds& deselected, bool clearAndSelect) signal

This signal is emitted when selection was changed.

Parameters
selected Newly selected feature ids
deselected Ids of all features which have previously been selected but are not any more
clearAndSelect In case this is set to true, the old selection was dismissed and the new selection corresponds to selected