Using C++ Models with Qt Quick Views

Data Provided In A Custom C++ Model

Models can be defined in C++ and then made available to QML. This is useful for exposing existing C++ data models or otherwise complex datasets to QML.

A C++ model class can be defined as a QStringList, a QVariantList, a QObjectList or a QAbstractItemModel. The first three are useful for exposing simpler datasets, while QAbstractItemModel provides a more flexible solution for more complex models.

Here is a video tutorial that takes you through the whole process of exposing a C++ model to QML: