Results 1 to 3 of 3

Thread: Caching icons in QListView::IconMode

  1. #1
    Join Date
    Jun 2010
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Caching icons in QListView::IconMode

    I am using QListView in IconMode to display items. The problem is, any kind of operation, even clicking for context menu or scrolling of items makes application non-responsive. The problem (seems) to be that every time I scroll, the view gets screen-full of data from the model (including Pixmaps for all the Icons). This IMO is the culprit that is slowing down the application. So I have decided to maintain an icon cache in the view.

    Now, to the best of my understanding (please correct me if I am wrong), I need to subclass the delegate so that view does not query for icon image each time there is need for it to be drawn. But the only way I have control over item drawing is to override the paint () function from QItemDelegate class. Is there a better way to do it, because this way I would have to implement all that the paint () function does in the base class, because I can not really use base class function as it works on QModelIndex.

    Can somebody help me on this?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Caching icons in QListView::IconMode

    It depends what your delegate is supposed to do. It might be easier if you focus on optimizing the model instead.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2010
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Caching icons in QListView::IconMode

    Actually I could optimize model to acceptable level. So the problem is under control now.

    Thanks for your response though!

Similar Threads

  1. Replies: 6
    Last Post: 30th December 2010, 11:19
  2. QT QListView (as icons)
    By Majdi in forum Newbie
    Replies: 10
    Last Post: 2nd March 2010, 23:22
  3. QListView Icons with uniform sizes
    By psih128 in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2009, 10:25
  4. QListView with icons on top of the text, not at the left
    By vfernandez in forum Qt Programming
    Replies: 7
    Last Post: 19th February 2009, 04:19
  5. how to put different sized icons in a QListView
    By namume in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2008, 10:57

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.