Results 1 to 2 of 2

Thread: Load QListViev item icons from URL's

  1. #1

    Default Load QListViev item icons from URL's

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Load QListViev item icons from URL's

    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,
    _

Similar Threads

  1. load a specific image for each item of listview
    By Binary01 in forum Qt Quick
    Replies: 4
    Last Post: 19th February 2016, 18:04
  2. Replies: 2
    Last Post: 8th April 2013, 06:40
  3. How to load icons from resource file
    By joseph in forum Qt Programming
    Replies: 7
    Last Post: 25th June 2012, 07:00
  4. Two icons for each item in QMenu?
    By ultr in forum Qt Programming
    Replies: 9
    Last Post: 15th December 2010, 15:13
  5. Replies: 2
    Last Post: 26th February 2010, 15:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.