Wt  3.7.1
Classes | Enumerations | Functions
Model/view system

Classes that implement Wt's model/view system. More...

Classes

struct  Wt::boost_any_traits< Type >
 A traits class for a type stored in a boost::any. More...
 
class  Wt::Chart::WAbstractChart
 Abstract base class for MVC-based charts. More...
 
class  Wt::Chart::WCartesianChart
 A cartesian chart. More...
 
class  Wt::Chart::WPieChart
 A pie chart. More...
 
class  Wt::Dbo::QueryModel< Result >
 A Wt MVC Model to view/edit query results. More...
 
class  Wt::Ext::ComboBox
 A widget that provides a drop-down combo-box control. More...
 
class  Wt::WAbstractItemDelegate
 Abstract delegate class for rendering an item in an item view. More...
 
class  Wt::WAbstractItemModel
 An abstract model for use with Wt's view classes. More...
 
class  Wt::WAbstractItemView
 An abstract base class for item Views. More...
 
class  Wt::WAbstractListModel
 An abstract list model for use with Wt's view classes. More...
 
class  Wt::WAbstractProxyModel
 An abstract proxy model for Wt's item models. More...
 
class  Wt::WAbstractTableModel
 An abstract table model for use with Wt's view classes. More...
 
class  Wt::WAggregateProxyModel
 A proxy model for Wt's item models that provides column aggregation. More...
 
class  Wt::WBatchEditProxyModel
 A proxy model for Wt's item models that provides batch editing. More...
 
class  Wt::WComboBox
 A widget that provides a drop-down combo-box control. More...
 
class  Wt::WItemDelegate
 Standard delegate class for rendering a view item. More...
 
class  Wt::WItemSelectionModel
 A class that represents a selection for a WAbstractItemView. More...
 
class  Wt::WModelIndex
 A value class that describes an index to an item in a data model. More...
 
class  Wt::WReadOnlyProxyModel
 A read-only wrapper for a source model. More...
 
class  Wt::WSelectionBox
 A selection box allows selection from a list of options. More...
 
class  Wt::WSortFilterProxyModel
 A proxy model for Wt's item models that provides filtering and/or sorting. More...
 
class  Wt::WStandardItem
 An item in a WStandardItemModel. More...
 
class  Wt::WStandardItemModel
 A standard data model, which stores its data in memory. More...
 
class  Wt::WStringListModel
 An model that manages a list of strings. More...
 
class  Wt::WSuggestionPopup
 A widget which popups to assist in editing a textarea or lineedit. More...
 
class  Wt::WTableView
 An MVC View widget for tabular data. More...
 
class  Wt::WTreeView
 A view class that displays a model as a tree or tree table. More...
 

Enumerations

enum  Wt::MatchFlag {
  Wt::MatchExactly = 0x0, Wt::MatchStringExactly = 0x1, Wt::MatchStartsWith = 0x2, Wt::MatchEndsWith = 0x3,
  Wt::MatchRegExp = 0x4, Wt::MatchWildCard = 0x5, Wt::MatchCaseSensitive = 0x10, Wt::MatchWrap = 0x20
}
 Flags that specify how to match two values. More...
 
enum  Wt::HeaderFlag {
  Wt::ColumnIsCollapsed = 0x1, Wt::ColumnIsExpandedLeft = 0x2, Wt::ColumnIsExpandedRight = 0x4, Wt::HeaderIsUserCheckable = 0x8,
  Wt::HeaderIsTristate = 0x10, Wt::HeaderIsXHTMLText = 0x40
}
 Flags that indicate table header options. More...
 
enum  Wt::ItemDataRole {
  Wt::DisplayRole = 0, Wt::DecorationRole = 1, Wt::EditRole = 2, Wt::StyleClassRole = 3,
  Wt::CheckStateRole = 4, Wt::ToolTipRole = 5, Wt::LinkRole = 6, Wt::MimeTypeRole = 7,
  Wt::LevelRole = 8, Wt::MarkerPenColorRole = 16, Wt::MarkerBrushColorRole = 17, Wt::MarkerScaleFactorRole = 20,
  Wt::MarkerTypeRole = 21, Wt::BarPenColorRole = 18, Wt::BarBrushColorRole = 19, Wt::UserRole = 32
}
 Enumeration that indicates a role for a data item. More...
 
enum  Wt::ItemFlag {
  Wt::ItemIsSelectable = 0x1, Wt::ItemIsEditable = 0x2, Wt::ItemIsUserCheckable = 0x4, Wt::ItemIsDragEnabled = 0x8,
  Wt::ItemIsDropEnabled = 0x10, Wt::ItemIsTristate = 0x20, Wt::ItemIsXHTMLText = 0x40, Wt::ItemIsDirty = 0x80,
  Wt::ItemHasDeferredTooltip = 0x100
}
 Flags that indicate data item options. More...
 
enum  Wt::SortOrder { Wt::AscendingOrder, Wt::DescendingOrder }
 Enumeration that indicates a sort order. More...
 
enum  Wt::DropAction { Wt::CopyAction = 0x1, Wt::MoveAction = 0x2 }
 Enumeration that indicates a drop action. More...
 

Functions

WString Wt::asString (const boost::any &v, const WString &formatString=WString())
 Interprets a boost::any as a string value. More...
 
double Wt::asNumber (const boost::any &v)
 Interprets a boost::any as a number value. More...
 
template<typename Type >
void Wt::registerType ()
 Registers MVC-support for a type passed in a boost::any. More...
 

Detailed Description

Classes that implement Wt's model/view system.

1. Models

The library provides support for tabular, tree-like and tree-table like models. All of these implement WAbstractItemModel.

Concrete model implementations

The following concrete model implementations are provided:

Proxy model implementations

Proxy models are helper models which wrap around another model, to provide additional functionality on top of the existing model. The following propy models:

Abstract models

Abstract models cannot be instantiated as such, but are the base point for custom model implementations:

2. Views

Item-based views

Graphical views

ExtJS-based (JavaScript-only) views

These views are being deprecated in favour of accessible counterparts.

3. Helper classes

Model indexes

WModelIndex represents an index to an item of a WAbstractItemModel, identified by a row, column and parent node.

Item delegates

Item delegates are used by WTableView and WTreeView to render a single item and to provide editing support.

The abstract base class is WAbstractItemDelegate, and a default implementation is provided by WItemDelegate.

Enumeration Type Documentation

◆ DropAction

Enumeration that indicates a drop action.

See also
WAbstractItemModel::dropEvent()
Enumerator
CopyAction 

Copy the selection.

MoveAction 

Move the selection (deleting originals)

◆ HeaderFlag

Flags that indicate table header options.

See also
WAbstractItemModel::headerFlags()
Enumerator
ColumnIsCollapsed 

Flag that indicates that the column can be expanded.

See also
WAbstractItemModel::expandColumn()
ColumnIsExpandedLeft 

Flag that indicates that the column was expanded to the left.

See also
WAbstractItemModel::collapseColumn()
ColumnIsExpandedRight 

Flag that indicates that the column was expanded to the right.

See also
WAbstractItemModel::collapseColumn()
HeaderIsUserCheckable 

Flag that indicates that the header can be checked.

HeaderIsTristate 

Flag that indicates that the item has three states.

When set, Wt::CheckStateRole data is of type Wt::CheckState

HeaderIsXHTMLText 

Flag that indicates that the item text (DisplayRole, ToolTipRole) is HTML.

◆ ItemDataRole

Enumeration that indicates a role for a data item.

A single data item can have data associated with it corresponding to different roles. Each role may be used by the corresponding view class in a different way.

See also
WModelIndex::data()
Enumerator
DisplayRole 

Role for textual representation.

DecorationRole 

Role for the url of an icon.

EditRole 

Role for the edited value.

StyleClassRole 

Role for the style class.

CheckStateRole 

Role that indicates the check state.

Data for this role should be a bool. When the Wt::ItemIsTristate flag is set for the item, data for this role should be of type Wt::CheckState.

ToolTipRole 

Role for a (plain) tooltip.

LinkRole 

Role for a link.

MimeTypeRole 

Role for mime type information.

LevelRole 

Level in aggregation, for header data.

MarkerPenColorRole 

Marker pen color (for Chart::WCartesianChart)

MarkerBrushColorRole 

Marker brush color (for Chart::WCartesianChart)

MarkerScaleFactorRole 

Marker size (for Chart::WCartesianChart)

MarkerTypeRole 

Marker type (for Chart::WCartesianChart)

BarPenColorRole 

Bar pen color (for Chart::WCartesianChart)

BarBrushColorRole 

Bar brush color (for Chart::WCartesianChart)

UserRole 

First role reserved for user purposes.

◆ ItemFlag

Flags that indicate data item options.

See also
WModelIndex::flags()
Enumerator
ItemIsSelectable 

Item can be selected.

ItemIsEditable 

Item can be edited.

ItemIsUserCheckable 

Item can be checked (checkbox is enabled)

ItemIsDragEnabled 

Item can be dragged.

ItemIsDropEnabled 

Item can be a drop target.

ItemIsTristate 

Item has tree states.

When set, Wt::CheckStateRole data is of type Wt::CheckState

ItemIsXHTMLText 

Item's text (DisplayRole, ToolTipRole) is HTML.

ItemIsDirty 

Item's value has been modified.

ItemHasDeferredTooltip 

Item's tooltip is deferred.

◆ MatchFlag

Flags that specify how to match two values.

Except when MatchExactly, the lexical matching is done (by comparing string representations of the value with the query). This is by default case insensitive, unless MatchCaseSensitive is OR'ed.

Enumerator
MatchExactly 

Same type and value.

MatchStringExactly 

Lexical match.

MatchStartsWith 

Match start with query.

MatchEndsWith 

Match end with query.

MatchRegExp 

Regular expression match.

MatchWildCard 

Wildcard match.

MatchCaseSensitive 

Case sensitive.

MatchWrap 

Wrap around whole model.

◆ SortOrder

Enumeration that indicates a sort order.

Enumerator
AscendingOrder 

Ascending sort order.

DescendingOrder 

Descending sort order.

Function Documentation

◆ asNumber()

double Wt::asNumber ( const boost::any &  v)

Interprets a boost::any as a number value.

The conversion works as follows:

  • A boost::any without a value, or a string that does not represent a number, is converted to a NaN.
  • A string is lexically casted to a double
  • Data of type WDate is converted to an integer number using WDate::toJulianDay().
  • Data of type WDateTime is converted to an integer number using WDateTime::toTime_t().
  • Data of type WTime is converted to an integer number as the number of milliseconds since midnight.

Other types are converted according to Wt::boost_any_traits<Type>::asNumber(). For these other types, you need to register their support first using Wt::registerType<Type>() and you may want to specialize Wt::boost_any_traits<Type> for a custom handling of their conversions.

See also
asString(), boost_any_traits

◆ asString()

WString Wt::asString ( const boost::any &  v,
const WString formatString = WString() 
)

Interprets a boost::any as a string value.

The conversion works as follows:

  • A boost::any without a value is converted to an empty string
  • Number values (integers and doubles) are formatted using the format string with snprintf(), or with boost::lexical_cast<> if the format string is empty.
  • Data of type WDate is converted with WDate::toString() using the indicated format string. If the format string is empty, WLocalce::currentLocale().dateFormat() is assumed.
  • Data of type WTime is converted with WTime::toString() using the indicated format string. If the format string is emtpy, WLocale::currentLocale().timeFormat() is assumed.
  • Data of type WDateTime is converted with WDateTime::toString() using the indicated format string. If the format string is empty, WLocale::currentLocale().dateTimeFormat() is assumed.

Other types are converted according to Wt::boost_any_traits<Type>::asString(). For these other types, you need to register their support first using Wt::registerType<Type>() and you may want to specialize Wt::boost_any_traits<Type> for a custom handling of their conversions.

See also
asNumber(), boost_any_traits

◆ registerType()

template<typename Type >
void Wt::registerType ( )

Registers MVC-support for a type passed in a boost::any.

By registering a type using this method, the global function Wt::asString(), which converts a boost::any to a string, will know how to interpret a boost::any holding a value of type Type using Wt::boost_any_traits<Type>::asString(). This gives Wt's built-in standard View classes the ability to display Wt::DisplayRole data of a Wt::WAbstractItemModel model.

Similarly, Wt::asNumber() uses Wt::boost_any_traits<Type>::asNumber() for use by Wt::Chart::WCartesianChart and Wt::Chart::WPieChart as numerical data.

The default implementation of Wt::boost_any_traits<Type> converts a value t to a Wt::WString by using boost::lexical_cast<std::string>() which it expects to return a UTF-8 string. This conversion thus relies on the std::ostream<< operator to be overloaded for the type. You may want to specialize Wt::boost_any_traits to provide a custom conversion for a type, or if you want to take into account the format string.

The following types are registered by Wt itself:

This method is thread-safe, and it is not an error to register the same type multiple times.


Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13