PDA

View Full Version : Load QListViev item icons from URL's



sajmplus
29th September 2016, 21:20
Hello,

i have QListView connected to custom model with ~1000 items. I load model data from WebAPI, one of item field is ImageURL.

I want to load images from ImageURL field into QListView icons. How can I achieve this?

I tried to return QPixmap pointer as Qt::DecorationRole and then start QNetworkAccessManager::get method for loading data into that QPixmap but with no success.

anda_skoa
30th September 2016, 11:41
If you download the image after the view has started processing the model, then you need to send a dataChanged() signal when the image becomes available.

And QPixmaps are not returned by pointer, but directly as the QVariant content.

Cheers,
_