Wt: Wt::WReadOnlyProxyModel Class Reference

Wt 3.3.0

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

- Class List
- Class Hierarchy
- Class Members

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

A read-only wrapper for a source model. More...

`#include <Wt/WReadOnlyProxyModel>`

Inheritance diagram for Wt::WReadOnlyProxyModel:
[legend]

List of all members.

## Public Member Functions
| WReadOnlyProxyModel (WObject *parent=0)
| Constructor.
virtual WModelIndex | mapFromSource (const WModelIndex &sourceIndex) const
| Maps a source model index to the proxy model.
virtual WModelIndex | mapToSource (const WModelIndex &proxyIndex) const
| Maps a proxy model index to the source model.
virtual int | columnCount (const WModelIndex &parent=WModelIndex()) const
| Returns the number of columns.
virtual int | rowCount (const WModelIndex &parent=WModelIndex()) const
| Returns the number of rows.
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

A read-only wrapper for a source model.

This is a simple proxy model which provides a read-only view on a source model. This is convenient for situations where you want to share a common read-only source model between different sessions.

## Member Function Documentation

int Wt::WReadOnlyProxyModel::columnCount | ( | const WModelIndex & | parent = `WModelIndex()` | ) | const`[virtual]`

Returns the number of columns.

This returns the number of columns at index `parent`.

See also:
  rowCount()

Implements Wt::WAbstractItemModel.

WModelIndex Wt::WReadOnlyProxyModel::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::WReadOnlyProxyModel::mapFromSource | ( | const WModelIndex & | sourceIndex | ) | const`[virtual]`

Maps a source model index to the proxy model.

This method returns a model index in the proxy model that corresponds to the model index `sourceIndex` in the source model. This method must only be implemented for source model indexes that are mapped and thus are the result of mapToSource().

See also:
  mapToSource()

Implements Wt::WAbstractProxyModel.

WModelIndex Wt::WReadOnlyProxyModel::mapToSource | ( | const WModelIndex & | proxyIndex | ) | const`[virtual]`

Maps a proxy model index to the source model.

This method returns a model index in the source model that corresponds to the proxy model index `proxyIndex`.

See also:
  mapFromSource()

Implements Wt::WAbstractProxyModel.

WModelIndex Wt::WReadOnlyProxyModel::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.

int Wt::WReadOnlyProxyModel::rowCount | ( | const WModelIndex & | parent = `WModelIndex()` | ) | const`[virtual]`

Returns the number of rows.

This returns the number of rows at index `parent`.

See also:
  columnCount()

Implements Wt::WAbstractItemModel.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator