Canvas Toolkit
← Class index

CAbstractProxyModel

Models and views · extends CAbstractItemModel

Base class for models that expose a transformed view of another model.

import { CAbstractProxyModel } from "canvas-toolkit-lib";

Declared members

sourceModel(): CAbstractItemModel | null;

Returns the model represented by this proxy.

setSourceModel(sourceModel: CAbstractItemModel | null): void;

Sets the model represented by this proxy.

abstract mapToSource(proxyIndex: CModelIndex): CModelIndex;

Maps an index owned by this proxy to its source-model index.

abstract mapFromSource(sourceIndex: CModelIndex): CModelIndex;

Maps a source-model index to its proxy-model index.

data(index: CModelIndex): unknown;

Returns data from the mapped source index.

setItemData(index: CModelIndex, value: unknown): boolean;

Writes data through to the mapped source index.

supportsTextEdits(): boolean;
undoStack(): CUndoStack | null;
applyTextEdits(edits: readonly CItemTextEdit[]): CItemTextEditError | null;

Resolves all source indexes before any edit can rearrange the proxy.

isEditable(index: CModelIndex): boolean;

Returns whether the mapped source index is editable.

headerData(section: number, orientation: COrientation): string | number | null;

Returns header data from the source model.

protected sourceModelChanged(_oldSourceModel: CAbstractItemModel | null, _newSourceModel: CAbstractItemModel | null): void;

Called after the source model changes.

protected sourceDataChanged(topLeft: CModelIndex, bottomRight: CModelIndex): void;

Handles a source-model data change.

protected sourceModelReset(): void;

Handles a reset of the source model.

protected sourceLayoutChanged(): void;

Handles a source-model layout change.