Wt: Wt::WAbstractTableModel Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::WAbstractTableModel Class Reference
Model/view system

An abstract table model for use with Wt's view classes. More...

`#include <Wt/WAbstractTableModel>`

Inheritance diagram for Wt::WAbstractTableModel:
[legend]

List of all members.

## Public Member Functions
| WAbstractTableModel (WObject *parent=0)
| Creates a new abstract list model.
| ~WAbstractTableModel ()
| Destructor.
virtual WModelIndex | parent (const WModelIndex &index) const
| Returns the parent for a model index.
virtual WModelIndex | index (int row, int column, const WModelIndex &parent=WModelIndex()) const
| Returns the child index for the given row and column.

## Detailed Description

An abstract table model for use with Wt's view classes.

An abstract table model specializes WAbstractItemModel for two-dimensional tables (but no hierarchical models).

It cannot be used directly but must be subclassed. Subclassed models must at least reimplement columnCount(), rowCount() and data().

## Member Function Documentation

WModelIndex Wt::WAbstractTableModel::index | ( | int | row,
|  | int | column,
|  | const WModelIndex & | parent = `WModelIndex()`
| ) |  | const`[virtual]`

Returns the child index for the given row and column.

When implementing this method, you can use createIndex() to create an index that corresponds to the item at `row` and `column` within `parent`.

If the location is invalid (out of bounds at the parent), then an invalid index must be returned.

See also:
  parent()

Implements Wt::WAbstractItemModel.

WModelIndex Wt::WAbstractTableModel::parent | ( | const WModelIndex & | index | ) | const`[virtual]`

Returns the parent for a model index.

An implementation should use createIndex() to create a model index that corresponds to the parent of a given index.

Note that the index itself may be stale (referencing a row/column within the parent that is outside the model geometry), but its parent (identified by the WModelIndex::internalPointer()) is referencing an existing parent. A stale index can only be used while the model geometry is being updated, i.e. during the emission of the corresponding [rows/columns](Being)[Removed/Inserted]() signals.

See also:
  index()

Implements Wt::WAbstractItemModel.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator