Qt 4.8
VisualDataModel Class Reference

The VisualDataModel encapsulates a model and delegate. More...

Detailed Description

The VisualDataModel encapsulates a model and delegate.

A VisualDataModel encapsulates a model and the delegate that will be instantiated for items in the model.

It is usually not necessary to create VisualDataModel elements. However, it can be useful for manipulating and accessing the modelIndex when a QAbstractItemModel subclass is used as the model. Also, VisualDataModel is used together with Package to provide delegates to multiple views.

The example below illustrates using a VisualDataModel with a ListView.

import QtQuick 1.0
Rectangle {
width: 200; height: 100
VisualDataModel {
id: visualModel
model: ListModel {
ListElement { name: "Apple" }
ListElement { name: "Orange" }
}
delegate: Rectangle {
height: 25
width: 100
Text { text: "Name: " + name}
}
}
ListView {
anchors.fill: parent
model: visualModel
}
}

The documentation for this class was generated from the following file: