Canvas Toolkit
← Class index

CModelIndex

Models and views

Identifies an item in an item model by row and column. An invalid index has negative coordinates or is not associated with a model.

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

Declared members

constructor(row?: number, column?: number, data?: unknown, model?: CAbstractItemModel | null);

Creates a model index. @param row Zero-based row, or `-1` for an invalid index. @param column Zero-based column, or `-1` for an invalid index. @param data Optional internal data associated with the index. @param model Model that owns the index.

row(): number;

Returns the zero-based row of the index.

column(): number;

Returns the zero-based column of the index.

data(): unknown;

Returns the internal data associated with the index.

model(): CAbstractItemModel | null;

Returns the model that owns this index, or `null`.

isValid(): boolean;

Returns whether the index refers to a valid model item.

equals(other: CModelIndex): boolean;

Returns whether this index identifies the same item as another index.