A data model provides the information to display in a list. This data is typically ordered hierarchically, and you can use index paths to uniquely identify each item in the model. To learn more about index paths, see Index paths.
You can associate a data model with a ListView, which provides the visual representation of the data in your app. The ListView queries the data model when it needs to display the data. You can associate a data model with any number of ListView objects to provide data for multiple lists in your app. To learn more about ListView, see List view.
In Cascades, the abstract DataModel class provides the main features of a data model. This class includes functions that you can use to retrieve the data that's associated with an item, and functions that determine if an item has any children in the model. This class also includes signals that are emitted when items are added to, removed from, or updated in the model.
You can use several predefined subclasses of DataModel to represent your data, or you can create your own data model by extending DataModel. There are three predefined subclasses that represent data from different sources: XmlDataModel, GroupDataModel, and ArrayDataModel. There's also a fourth subclass of DataModel, called QListDataModel, which isn't used often. Most of the important features of QListDataModel are available in ArrayDataModel.
Last modified: 2015-03-31