Canvas Toolkit
← Class index

CAbstractItemDelegate

Widgets · extends CObject

Abstract base class for item view editors.

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

Declared members

readonly commitData: CSignal<[CWidget]>;

Emitted when an editor wants its value written to the model.

readonly closeEditor: CSignal<[CWidget]>;

Emitted when an editor wants to be closed.

paint(_painter: CPainter, _rect: CRect, _index: CModelIndex, _widget: CWidget): boolean;

Paints an item and returns whether the delegate handled it.

editorEvent(_event: CEvent, _model: CAbstractItemModel, _index: CModelIndex, _rect: CRect): boolean;

Handles an item event and returns whether it was consumed.

abstract createEditor(parent: CWidget, index: CModelIndex): CWidget | null;

Creates an editor for an item. @param parent Parent widget for the editor. @param index Model index being edited.

abstract setEditorData(editor: CWidget, index: CModelIndex): void;

Copies model data into an editor.

abstract setModelData(editor: CWidget, model: CAbstractItemModel, index: CModelIndex): void;

Writes editor data back to the model.

editorShown(_editor: CWidget, _index: CModelIndex): void;

Called after an editor has been positioned, shown and focused.

updateEditorGeometry(editor: CWidget, rect: CRect): void;

Updates the editor geometry to match an item rectangle.