Results 1 to 11 of 11

Thread: QListView unresponsive when painting images

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2015
    Posts
    6
    Thanks
    1

    Exclamation QListView unresponsive when painting images

    Hello
    I have set up a QAbstractListModel together with a QStyledItemDelegate and QListView.
    In the model i have a method called "populate" which will search the local disk for some data, and then append it to the data list in the model via a signal. The signal invokes layoutChanged() (don't know how to use dataChanged anywhere except in the obligatory data method), which will then refresh the layout with the new data. (This happens only once)
    The QStyledItemDelegate draws the items on the QListView in iconMode gridview.
    Everything is working except the QListView being unresponsive, lagging, flicks and won't allow me to scroll for a long time.
    The messages i get in the console are:
    QBuffer::seek: Invalid pos: -345244657
    QBuffer::seek: Invalid pos: -345244657

    - multiple times everytime i move my mouse in the QListView.
    I did some research before writing this, but couldn't find anything useful.
    I suspect this being the main reason on why the QListView is so unresponsive, and i think it's something related to the QIcon i make.
    However i did some profiling and saw that the paint method in the Delegate got called over 200 times in an elapsed time of 1 minute without me touching the mouse.

    My code:
    http://pastebin.com/gjKJwJuU

    Things to note:
    I use PyQt5 but can understand slight C++ code.
    Pseudo code will only be useful for me if you include the methods being called.

    Edit #1:
    I just realized that with the fetchMore method, I don't need to emit layoutChanged so i removed that.
    I also moved the endResetModel() call up to the append method, because that's when items are actually added into the model.
    This changed nothing. ListView is still being unresposive/lagging. I also tried only adding 3-5 items to the list still getting same results...

    Edit #2:
    Okay so i stopped the paint method in the delegate from painting the images, which seems to have fixed the laggy QListView...
    I also stopped getting the QBuffer::seek invalid pos: -xxxxxx messages.
    So now i have another question.
    How do i fix the lagging in the QListView when painting images?

    I'm changing the title to this question instead of: QBuffer::seek invalid pos: -xxxxxx.
    Last edited by isplasher; 4th May 2015 at 17:55.

Similar Threads

  1. Replies: 8
    Last Post: 17th May 2012, 11:09
  2. QSharedMemory, signals and QBuffer
    By sky in forum Qt Programming
    Replies: 1
    Last Post: 23rd November 2011, 05:06
  3. QBuffer::readLine()
    By vfernandez in forum Qt Programming
    Replies: 2
    Last Post: 23rd April 2010, 20:57
  4. how can convert QFile to QBuffer?
    By learning_qt in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2009, 13:34
  5. QBuffer bytesWritten() problem
    By QAlex in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2009, 09:05

Tags for this Thread

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.