Hi Andre,
Yes, it depends :)
And I find another way to play with ListView model
1. qmlRegisterType a customized C++ Model such as:
qmlRegisterType<MyModel>("cn.com.i-soft.demo", 1, 0, "MyModel");
2. QStringList property or QObjectList, QList such as:
Q_PROPERTY(QStringList myLists READ myLists NOTIFY myListsChanged)
3. put MyModel in QML such as:
import cn.com.i-soft.demo 1.0
...
ListView {
...
MyModel {
id: myModel
}
model: myModel.myLists
delegate: Rectangle {
...
Text { text: modelData }
}
}
Regards,
Leslie Zhai
↧