[Qt-qml] Image Provider

warwick.allison at nokia.com warwick.allison at nokia.com
Thu Apr 1 02:48:55 CEST 2010


> I want to load all images once,
> regardless the objects that uses that images are loaded or not.

Ah, then what you're doing sounds pretty well right. The purpose of the Image Provider is to allow the application code to do the custom image part while leaving the threading part to the engine. If you're happy also doing the threading part yourself, you don't need the image provider.

> Since I would have to maintain a list of QImages that eventually would be converted
> (duplicated) to a QPixmap in the main thread.

You're list would only need to contain the images that have not yet been requested - memory would only be used in one place. Of course, once the cache was full you'd have to reload images, but there is never infinite memory, so that's necessary anyway.

> The downside is that I wouldn't be
> able to visualize it with the qml viewer.

If you write your bulk-pixmap-loader as a plugin, you can.

http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeextensionplugin.html

--
Warwick




More information about the Qt-qml mailing list