CItemSelectionModel
Tracks the current index and selected indexes for an item model.
Module models/CItemSelectionModel.js. This class is available through the browser modules in the download.
Declared members
readonly currentChanged: CSignal<[CModelIndex, CModelIndex]>;Emitted when the current index changes.
readonly selectionChanged: CSignal<[CModelIndex[], CModelIndex[]]>;Emitted with newly selected and deselected indexes.
constructor(model: CAbstractItemModel, parent?: CObject | null);Creates a selection model for the specified item model.
model(): CAbstractItemModel;Returns the item model whose selection is tracked.
currentIndex(): CModelIndex;Returns the current model index.
setCurrentIndex(index: CModelIndex): void;Sets the current index if it belongs to the associated model.
hasSelection(): boolean;Returns whether at least one index is selected.
isSelected(index: CModelIndex): boolean;Returns whether the specified index is selected.
selectedIndexes(): CModelIndex[];Returns a copy of the selected indexes.
indexesForRowChange(): CModelIndex[];@internal Includes former coordinates when a removal has already shortened the model.
selectedIndexesInRowOrder(): IterableIterator<CModelIndex>;@internal Iterates a flat table selection in view row and column order.
select(index: CModelIndex): void;Adds a valid index from the associated model to the selection.
selectRectangle(anchor: CModelIndex, end: CModelIndex): void;@internal Replaces the selection with a rectangle in a flat model.
deselect(index: CModelIndex): void;Removes an index from the selection.
clearSelection(): void;Clears all selected indexes while preserving the current index.
clear(): void;Clears both the selection and the current index.
remapIndexes(oldIndexes: CModelIndex[], newIndexes: CModelIndex[]): void;Remaps current and selected indexes after a model layout change.