[Qt-qml] Returning a QImage to QML from C++ for a ListView delegate...

Antti.Saukko at nokia.com Antti.Saukko at nokia.com
Fri Nov 19 08:21:05 CET 2010


>Hi,
>
>When you have a list object existing in native C++ side and 
>you wan't to populate the QML ListView with it. For "normal" 
>data like integers and strings it works fine by using 
>QDeclarativeListProperty.
>
>But the problem comes when you want to have an individual 
>image for each list item. With QDeclarativeImageProvider you 
>can populate the list items with the same image instance, but 
>how to have an individual image for each item seems to be problematic.
>

Hi Tuomas,

Why can't you use your abstractlistmodel to populate the source for an individual delegate? This should not be any different from exposing a string? Just that in this case, the string is an url or uses qdeclarativeimageprovider to provide your custom image source.

- antti





More information about the Qt-qml mailing list