A proxy model for Wt's item models that provides column aggregation. More...
#include <Wt/WAggregateProxyModel>
Public Member Functions | |
WAggregateProxyModel (WObject *parent=0) | |
Constructor. More... | |
virtual | ~WAggregateProxyModel () |
Destructor. | |
void | addAggregate (int parentColumn, int firstColumn, int lastColumn) |
Adds a new column aggregation definition. More... | |
virtual WModelIndex | mapFromSource (const WModelIndex &sourceIndex) const |
Maps a source model index to the proxy model. More... | |
virtual WModelIndex | mapToSource (const WModelIndex &proxyIndex) const |
Maps a proxy model index to the source model. More... | |
virtual void | setSourceModel (WAbstractItemModel *sourceModel) |
Sets the source model. More... | |
virtual void | expandColumn (int column) |
Expands a column. More... | |
virtual void | collapseColumn (int column) |
Collapses a column. More... | |
virtual int | columnCount (const WModelIndex &parent=WModelIndex()) const |
Returns the number of columns. More... | |
virtual int | rowCount (const WModelIndex &parent=WModelIndex()) const |
Returns the number of rows. More... | |
virtual WFlags< HeaderFlag > | headerFlags (int section, Orientation orientation=Horizontal) const |
Returns the flags for a header. More... | |
virtual bool | setHeaderData (int section, Orientation orientation, const boost::any &value, int role=EditRole) |
Sets header data for a column or row. More... | |
virtual boost::any | headerData (int section, Orientation orientation=Horizontal, int role=DisplayRole) const |
Returns the row or column header data. More... | |
virtual WModelIndex | parent (const WModelIndex &index) const |
Returns the parent for a model index. More... | |
virtual WModelIndex | index (int row, int column, const WModelIndex &parent=WModelIndex()) const |
Returns the child index for the given row and column. More... | |
virtual void | sort (int column, SortOrder order=AscendingOrder) |
Sorts the model according to a particular column. More... | |
![]() | |
WAbstractProxyModel (WObject *parent=0) | |
Constructor. | |
WAbstractItemModel * | sourceModel () const |
Returns the source model. More... | |
![]() | |
WAbstractItemModel (WObject *parent=0) | |
Creates a new data model. | |
virtual WFlags< ItemFlag > | flags (const WModelIndex &index) const |
Returns the flags for an item. More... | |
virtual bool | hasChildren (const WModelIndex &index) const |
Returns if there are children at an index. More... | |
virtual boost::any | data (const WModelIndex &index, int role=DisplayRole) const =0 |
Returns data at a specific model index. More... | |
virtual DataMap | itemData (const WModelIndex &index) const |
Returns all data at a specific index. More... | |
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. More... | |
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. More... | |
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). More... | |
virtual bool | insertColumns (int column, int count, const WModelIndex &parent=WModelIndex()) |
Inserts one or more columns. More... | |
virtual bool | insertRows (int row, int count, const WModelIndex &parent=WModelIndex()) |
Inserts one or more rows. More... | |
virtual bool | removeColumns (int column, int count, const WModelIndex &parent=WModelIndex()) |
Removes columns. More... | |
virtual bool | removeRows (int row, int count, const WModelIndex &parent=WModelIndex()) |
Removes rows. More... | |
virtual bool | setData (const WModelIndex &index, const boost::any &value, int role=EditRole) |
Sets data at the given model index. More... | |
virtual bool | setItemData (const WModelIndex &index, const DataMap &values) |
Sets data at the given model index. More... | |
bool | setHeaderData (int section, const boost::any &value) |
Sets column header data. More... | |
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. More... | |
virtual WModelIndex | fromRawIndex (void *rawIndex) const |
Converts a raw pointer to a model index. More... | |
virtual std::string | mimeType () const |
Returns a mime-type for dragging a set of indexes. More... | |
virtual std::vector< std::string > | acceptDropMimeTypes () const |
Returns a list of mime-types that could be accepted for a drop event. More... | |
virtual void | dropEvent (const WDropEvent &e, DropAction action, int row, int column, const WModelIndex &parent) |
Handles a drop event. More... | |
bool | insertColumn (int column, const WModelIndex &parent=WModelIndex()) |
Inserts one column. More... | |
bool | insertRow (int row, const WModelIndex &parent=WModelIndex()) |
Inserts one row. More... | |
bool | removeColumn (int column, const WModelIndex &parent=WModelIndex()) |
Removes one column. More... | |
bool | removeRow (int row, const WModelIndex &parent=WModelIndex()) |
Removes one row. More... | |
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. More... | |
virtual Signal< WModelIndex, int, int > & | columnsAboutToBeInserted () |
Signal emitted before a number of columns will be inserted. More... | |
virtual Signal< WModelIndex, int, int > & | columnsAboutToBeRemoved () |
Signal emitted before a number of columns will be removed. More... | |
virtual Signal< WModelIndex, int, int > & | columnsInserted () |
Signal emitted after a number of columns were inserted. More... | |
virtual Signal< WModelIndex, int, int > & | columnsRemoved () |
Signal emitted after a number of columns were removed. More... | |
virtual Signal< WModelIndex, int, int > & | rowsAboutToBeInserted () |
Signal emitted before a number of rows will be inserted. More... | |
virtual Signal< WModelIndex, int, int > & | rowsAboutToBeRemoved () |
Signal emitted before a number of rows will be removed. More... | |
virtual Signal< WModelIndex, int, int > & | rowsInserted () |
Signal emitted after a number of rows were inserted. More... | |
virtual Signal< WModelIndex, int, int > & | rowsRemoved () |
Signal emitted after a number of rows were removed. More... | |
virtual Signal< WModelIndex, WModelIndex > & | dataChanged () |
Signal emitted when some data was changed. More... | |
virtual Signal< Orientation, int, int > & | headerDataChanged () |
Signal emitted when some header data was changed. More... | |
virtual Signal & | layoutAboutToBeChanged () |
Signal emitted when the layout is about to be changed. More... | |
virtual Signal & | layoutChanged () |
Signal emitted when the layout is changed. More... | |
virtual Signal & | modelReset () |
Signal emitted when the model was reset. More... | |
![]() | |
WObject (WObject *parent=0) | |
Create a WObject with a given parent object. More... | |
virtual | ~WObject () |
Destructor. More... | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. More... | |
void | setObjectName (const std::string &name) |
Sets an object name. More... | |
virtual std::string | objectName () const |
Returns the object name. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
void | addChild (WObject *child) |
Adds a child object. More... | |
virtual void | removeChild (WObject *child) |
Removes a child object. More... | |
const std::vector< WObject * > & | children () const |
Returns the children. | |
WObject * | parent () const |
Returns the parent object. | |
Additional Inherited Members | |
![]() | |
typedef std::map< int, boost::any > | DataMap |
Data map. More... | |
![]() | |
typedef std::map< WModelIndex, BaseItem * > | ItemMap |
A map for items. More... | |
![]() | |
WModelIndex | createSourceIndex (int row, int column, void *ptr) const |
Create a source model index. More... | |
void | shiftModelIndexes (const WModelIndex &sourceParent, int start, int count, ItemMap &items) |
Utility methods to shift items in an item map. More... | |
![]() | |
static WObject * | sender () |
Returns the sender of the current slot call. More... | |
A proxy model for Wt's item models that provides column aggregation.
This proxy model does not store data itself, but presents data from a source model, and presents methods to organize columns using aggregation, through which a user may navigate (usually to obtain more detailed results related to a single aggregate quantity).
To use this proxy model, you should provide a source model using setSourceModel(), and define column ranges that can be aggregated using addAggregate().
Example:
This example would render like this:
Wt::WAggregateProxyModel::WAggregateProxyModel | ( | WObject * | parent = 0 | ) |
Constructor.
Sets up the proxy without aggregation functionality.
void Wt::WAggregateProxyModel::addAggregate | ( | int | parentColumn, |
int | firstColumn, | ||
int | lastColumn | ||
) |
Adds a new column aggregation definition.
The \p parentColumn is the column index in the source model that acts as an aggregate for columns \p firstColumn to \p lastColumn. \p parentColumn must border the range defined by \p firstColumn to \p lastColumn:
Note that column parameters reference column indexes in the source model.
Aggregation definitions can be nested, but should be strictly hierarchical.
The aggregate column will initially be collapsed.
Only one aggregate can be defined per parentColumn
.
|
virtual |
Collapses a column.
Collapses a column. This may only be called by a view when the Wt::ColumnIsExpandedLeft or Wt::ColumnIsExpandedRight flag is set. The default implementation does nothing.
Reimplemented from Wt::WAbstractItemModel.
|
virtual |
Returns the number of columns.
This returns the number of columns at index \p parent.
Implements Wt::WAbstractItemModel.
|
virtual |
Expands a column.
Expands a column. This may only be called by a view when the Wt::ColumnIsCollapsed flag is set. The default implementation does nothing.
Reimplemented from Wt::WAbstractItemModel.
|
virtual |
Returns the row or column header data.
When \p orientation is \link Wt::Horizontal Horizontal\endlink, \p section is a column number, when \p orientation is \link Wt::Vertical Vertical\endlink, \p section is a row number.
Reimplemented from Wt::WAbstractItemModel.
|
virtual |
Returns the flags for a header.
The default implementation returns no flags set.
Reimplemented from Wt::WAbstractItemModel.
|
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 \p row and \p column within \p parent. If the location is invalid (out of bounds at the parent), then an invalid index must be returned.
Implements Wt::WAbstractItemModel.
|
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 \p 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().
Implements Wt::WAbstractProxyModel.
|
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 \p proxyIndex.
Implements Wt::WAbstractProxyModel.
|
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.
Implements Wt::WAbstractItemModel.
|
virtual |
Returns the number of rows.
This returns the number of rows at index \p parent.
Implements Wt::WAbstractItemModel.
|
virtual |
Sets header data for a column or row.
Returns \c true if the operation was successful.
Reimplemented from Wt::WAbstractItemModel.
|
virtual |
Sets the source model.
The source model provides the actual data for the proxy model.
Ownership of the source model is not transferred.
Reimplemented from Wt::WAbstractProxyModel.
|
virtual |
Sorts the model according to a particular column.
If the model supports sorting, then it should emit the layoutAboutToBeChanged() signal, rearrange its items, and afterwards emit the layoutChanged() signal.
Reimplemented from Wt::WAbstractItemModel.