Wt  3.3.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
Wt::WReadOnlyProxyModel Class Reference

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

#include <Wt/WReadOnlyProxyModel>

Inheritance diagram for Wt::WReadOnlyProxyModel:
Inheritance graph
[legend]

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.
- Public Member Functions inherited from Wt::WAbstractProxyModel
 WAbstractProxyModel (WObject *parent=0)
 Constructor.
virtual void setSourceModel (WAbstractItemModel *sourceModel)
 Sets the source model.
WAbstractItemModelsourceModel () const
 Returns the source model.
- Public Member Functions inherited from Wt::WAbstractItemModel
 WAbstractItemModel (WObject *parent=0)
 Creates a new data model.
virtual WFlags< ItemFlagflags (const WModelIndex &index) const
 Returns the flags for an item.
virtual WFlags< HeaderFlagheaderFlags (int section, Orientation orientation=Horizontal) const
 Returns the flags for a header.
virtual bool hasChildren (const WModelIndex &index) const
 Returns if there are children at an index.
virtual boost::any data (const WModelIndex &index, int role=DisplayRole) const =0
 Returns data at a specific model index.
virtual DataMap itemData (const WModelIndex &index) const
 Returns all data at a specific index.
virtual boost::any headerData (int section, Orientation orientation=Horizontal, int role=DisplayRole) const
 Returns the row or column header data.
virtual WModelIndexList match (const WModelIndex &start, int role, const boost::any &value, int hits=-1, WFlags< MatchFlag > flags=WFlags< MatchFlag >(MatchStartsWith|MatchWrap)) const
 Returns an index list for data items that match.
boost::any data (int row, int column, int role=DisplayRole, const WModelIndex &parent=WModelIndex()) const
 Returns the data item at the given column and row.
virtual bool hasIndex (int row, int column, const WModelIndex &parent=WModelIndex()) const
 Returns if an index at the given position is valid (i.e. falls within the column-row bounds).
virtual bool insertColumns (int column, int count, const WModelIndex &parent=WModelIndex())
 Inserts one or more columns.
virtual bool insertRows (int row, int count, const WModelIndex &parent=WModelIndex())
 Inserts one or more rows.
virtual bool removeColumns (int column, int count, const WModelIndex &parent=WModelIndex())
 Removes columns.
virtual bool removeRows (int row, int count, const WModelIndex &parent=WModelIndex())
 Removes rows.
virtual bool setData (const WModelIndex &index, const boost::any &value, int role=EditRole)
 Sets data at the given model index.
virtual bool setItemData (const WModelIndex &index, const DataMap &values)
 Sets data at the given model index.
virtual bool setHeaderData (int section, Orientation orientation, const boost::any &value, int role=EditRole)
 Sets header data for a column or row.
bool setHeaderData (int section, const boost::any &value)
 Sets column header data.
virtual void sort (int column, SortOrder order=AscendingOrder)
 Sorts the model according to a particular column.
virtual void expandColumn (int column)
 Expands a column.
virtual void collapseColumn (int column)
 Collapses a column.
virtual void * toRawIndex (const WModelIndex &index) const
 Converts a model index to a raw pointer that remains valid while the model's layout is changed.
virtual WModelIndex fromRawIndex (void *rawIndex) const
 Converts a raw pointer to a model index.
virtual std::string mimeType () const
 Returns a mime-type for dragging a set of indexes.
virtual std::vector< std::string > acceptDropMimeTypes () const
 Returns a list of mime-types that could be accepted for a drop event.
virtual void dropEvent (const WDropEvent &e, DropAction action, int row, int column, const WModelIndex &parent)
 Handles a drop event.
bool insertColumn (int column, const WModelIndex &parent=WModelIndex())
 Inserts one column.
bool insertRow (int row, const WModelIndex &parent=WModelIndex())
 Inserts one row.
bool removeColumn (int column, const WModelIndex &parent=WModelIndex())
 Removes one column.
bool removeRow (int row, const WModelIndex &parent=WModelIndex())
 Removes one row.
bool setData (int row, int column, const boost::any &value, int role=EditRole, const WModelIndex &parent=WModelIndex())
 Sets data at the given row and column.
virtual Signal< WModelIndex,
int, int > & 
columnsAboutToBeInserted ()
 Signal emitted before a number of columns will be inserted.
virtual Signal< WModelIndex,
int, int > & 
columnsAboutToBeRemoved ()
 Signal emitted before a number of columns will be removed.
virtual Signal< WModelIndex,
int, int > & 
columnsInserted ()
 Signal emitted after a number of columns were inserted.
virtual Signal< WModelIndex,
int, int > & 
columnsRemoved ()
 Signal emitted after a number of columns were removed.
virtual Signal< WModelIndex,
int, int > & 
rowsAboutToBeInserted ()
 Signal emitted before a number of rows will be inserted.
virtual Signal< WModelIndex,
int, int > & 
rowsAboutToBeRemoved ()
 Signal emitted before a number of rows will be removed.
virtual Signal< WModelIndex,
int, int > & 
rowsInserted ()
 Signal emitted after a number of rows were inserted.
virtual Signal< WModelIndex,
int, int > & 
rowsRemoved ()
 Signal emitted after a number of rows were removed.
virtual Signal< WModelIndex,
WModelIndex > & 
dataChanged ()
 Signal emitted when some data was changed.
virtual Signal< Orientation,
int, int > & 
headerDataChanged ()
 Signal emitted when some header data was changed.
virtual SignallayoutAboutToBeChanged ()
 Signal emitted when the layout is about to be changed.
virtual SignallayoutChanged ()
 Signal emitted when the layout is changed.
virtual SignalmodelReset ()
 Signal emitted when the model was reset.
- Public Member Functions inherited from Wt::WObject
 WObject (WObject *parent=0)
 Create a WObject with a given parent object.
virtual ~WObject ()
 Destructor.
virtual const std::string id () const
 Returns the (unique) identifier for this object.
void setObjectName (const std::string &name)
 Sets an object name.
virtual std::string objectName () const
 Returns the object name.
void resetLearnedSlots ()
 Resets learned stateless slot implementations.
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation.
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation.
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance.
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method.
void addChild (WObject *child)
 Adds a child object.
virtual void removeChild (WObject *child)
 Removes a child object.
const std::vector< WObject * > & children () const
 Returns the children.
WObjectparent () const
 Returns the parent object.

Additional Inherited Members

- Public Types inherited from Wt::WAbstractItemModel
typedef std::map< int, boost::any > DataMap
 Data map.
- Protected Types inherited from Wt::WAbstractProxyModel
typedef std::map< WModelIndex,
BaseItem * > 
ItemMap
 A map for items.
- Protected Member Functions inherited from Wt::WAbstractProxyModel
WModelIndex createSourceIndex (int row, int column, void *ptr) const
 Create a source model index.
void shiftModelIndexes (const WModelIndex &sourceParent, int start, int count, ItemMap &items)
 Utility methods to shift items in an item map.
- Static Protected Member Functions inherited from Wt::WObject
static WObjectsender ()
 Returns the sender of the current slot call.

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.


Generated on Thu May 30 2013 for the C++ Web Toolkit (Wt) by doxygen 1.8.1.2