Class: QgsFeatureSelectionModel

class qgis.gui.QgsFeatureSelectionModel(model: QAbstractItemModel | None, featureModel: QgsFeatureModel | None, featureSelectionHandler: QgsIFeatureSelectionManager | None, parent: QObject | None)

Bases: PyQt5.QtCore.QItemSelectionModel

Methods

childEvent

connectNotify

customEvent

disconnectNotify

emitSelectionChanged

enableSync

Enables or disables synchronisation to the QgsVectorLayer When synchronisation is disabled, any selection change will be buffered inside this selection model.

isSelected

Returns the selection status of a given feature id.

isSignalConnected

receivers

select

Overwritten to do NOTHING (we handle selection ourselves)

selectFeatures

Select features on this table.

sender

senderSignalIndex

setFeatureSelectionManager

param featureSelectionManager:

timerEvent

Signals

requestRepaint

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

childEvent(self, a0: QChildEvent | None)
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent | None)
disconnectNotify(self, signal: QMetaMethod)
emitSelectionChanged(self, newSelection: QItemSelection, oldSelection: QItemSelection)
enableSync(self, enable: bool)

Enables or disables synchronisation to the QgsVectorLayer When synchronisation is disabled, any selection change will be buffered inside this selection model. When enabled, any buffered changes are communicated to the layer and the buffer is emptied. Mainly to be used for performance reasons, because selection change on the layer can cost time as it repaints the layer.

Parameters:

enable (bool) – The synchronisation status to set.

isSelected(self, fid: int) bool

Returns the selection status of a given feature id.

Parameters:

fid (int) – The featureid to determine the selection status of

Returns:

The selection status

isSelected(self, index: QModelIndex) -> bool Returns the selection status of a given QModelIndex.

Parameters:

index – The index to determine the selection status of

Return type:

bool

Returns:

The selection status

isSignalConnected(self, signal: QMetaMethod) bool
receivers(self, signal: PYQT_SIGNAL) int
requestRepaint

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.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

select(self, index: QModelIndex, command: QItemSelectionModel.SelectionFlags | QItemSelectionModel.SelectionFlag)

Overwritten to do NOTHING (we handle selection ourselves)

See also

selectFeatures()

select(self, selection: QItemSelection, command: Union[QItemSelectionModel.SelectionFlags, QItemSelectionModel.SelectionFlag]) Overwritten to do NOTHING (we handle selection ourselves)

See also

selectFeatures()

Parameters:
  • index (QModelIndex)

  • command (Union[QItemSelectionModel.SelectionFlags)

selectFeatures(self, selection: QItemSelection, command: QItemSelectionModel.SelectionFlags | QItemSelectionModel.SelectionFlag)

Select features on this table. Is to be used in favor of the stock select methods.

Parameters:
  • selection (QItemSelection) – The QItemSelection which will be selected

  • command (Union[QItemSelectionModel.SelectionFlags) – The command to apply. Select, Deselect and ClearAndSelect are processed.

sender(self) QObject | None
senderSignalIndex(self) int
setFeatureSelectionManager(self, featureSelectionManager: QgsIFeatureSelectionManager | None)
Parameters:

featureSelectionManager (Optional[QgsIFeatureSelectionManager])

timerEvent(self, a0: QTimerEvent | None)