Canvas Toolkit
← Class index

CAbstractItemView

Widgets · extends CWidget

Provides common model, selection, delegate and editor behavior for item views.

Module widgets/CAbstractItemView.js. This class is available through the browser modules in the download.

Declared members

constructor(parent?: CWidget | null);

Creates a new item view.

model(): CAbstractItemModel | null;

Returns the current model.

setModel(model: CAbstractItemModel | null): void;

Sets the model used by the view.

selectionModel(): CItemSelectionModel | null;

Returns the selection model.

currentIndex(): CModelIndex;

Returns the current index.

setCurrentIndex(index: CModelIndex): void;

Sets the current index.

itemDelegate(): CAbstractItemDelegate;

Returns the default item delegate.

setItemDelegate(delegate: CAbstractItemDelegate): void;

Sets the default item delegate.

setItemDelegateForRow(row: number, delegate: CAbstractItemDelegate | null): void;

Sets the delegate used for a row.

setItemDelegateForColumn(column: number, delegate: CAbstractItemDelegate | null): void;

Sets the delegate used for a column.

itemDelegateForIndex(index: CModelIndex): CAbstractItemDelegate;

Returns the delegate used for an index.

edit(index: CModelIndex): boolean;

Starts editing an item through its delegate.

abstract visualRect(index: CModelIndex): CRect;

Returns the item rectangle in editor-parent coordinates.

protected abstract editorParent(): CWidget;

Returns the widget used as editor parent.

protected modelChanged(_oldModel: CAbstractItemModel | null, _newModel: CAbstractItemModel | null): void;

Called after the model changes.

protected modelDataChanged(): void;

Called when data in the model changes.

protected modelReset(): void;

Called after the current model is reset.

protected modelLayoutChanged(): void;

Called after indexes in the current model are rearranged.

protected modelRowsInserted(_parent: CModelIndex, _first: number, _last: number): void;

Called after rows are inserted into the current model.

protected modelRowsRemoved(_parent: CModelIndex, _first: number, _last: number): void;

Called after rows are removed from the current model.

protected currentIndexChanged(index: CModelIndex): void;
protected editorClosed(): void;

Called after the active editor is closed.

protected updateEditorGeometry(): void;

Updates the geometry of the active editor.