Answer from Digia:
bq. As Image requires url, you cannot directly specify QImage for it. One
option would be to change the QImage to QString and then use the QString as image source. So add images to resource file and use in cpp:
Constructor:
@Animal(const QString &type, const QString &size, const QString &image);@
Adding an animal:
@model.addAnimal(Animal("Wolf", "Medium", "my_image.png")@
and then in qml:
@ListView {
width: 200; height: 250
model: myModel
Component {
id: modelDelegate
Item {
width: 180; height: 40
Row {
Text { text: "Animal: " + type + ", " + size }
Image {source: image}
}
}
}
delegate: modelDelegate
}@
Another option would be to use QQuickImageProvider class.
http://qt-project.org/doc/qt-5.0/qtquick/qquickimageprovider.html
An example of how to use QQuickImageProvider can be found from:
\qtdeclarative\examples\quick\imageprovider