Examples

Explore some live examples of Wt below.

The source code of these (and many more) examples is included in the Wt source distribution. You may also browse through the source code of each example using the source code viewer, following the link below each example.

Cross-linked source code for these examples is also in doxygen documentation (in a new window).

Git explorer

Run example

This example serves as a demo for a custom model implementation which can be used by Wt's item View classes, such as WTreeView.

A WStandardItemModel can be populated with data retrieved from for example a database. A draw-back is however that all data must be retrieved in advance and is kept in session memory. By reimplementing WAbstractItemModel, you can however implement a model that reads (or computes) the data only when needed, and provides a trade-off between keeping data in memory or fetching it from the source.

In this example, we implement a tree model that navigates a git repository. The model lazy-stores folder nodes in memory, but reads all other data directly from git. Initially we thought the SHA-1 id's could be used, but folders with the same content in different places of the git repository have the same SHA-1 ID's while representing different model indexes.

Browse the source code