Hi! I'm trying to write an application where I show thumbnails of files in a directory. I would like, of course, the GUI to be quite responsive while thumbnails are created. Therefore, I wrote a thread which creates thumbnails and adds them to a subclass I made of QGraphicsView. It seems it's behaving quite good, but not entirely as I thought it would.
The strange thing is that, when I run my application, instead of starting to show, one by one, the generated thumbnails, it waits a little bit, and then shows, all together, many thumbnails. After that, again it waits quite some time, and again shows many thumbnails... etc.... I mean that it seems the GUI is not showing thumbnails as soon as the thread gives them, but at certain points, after some are collected.
Is there anyone who can try to guess why? The generating thread has the LowestPriority, so I suppose, when I tell the view to show the images, the GUI should do that immediately having higher priority...
My suspect is that, this line in my generating thread:
which adds my thumbnail to the QGraphicsView using the addItem(...) method, is run within my generating thread, and not the main thread (which manages the GUI). Is this correct? But in case this was true, shouldn't it wait until the thumbnail was shown before generating the following thumbnail? Still doesn't explain the result. Any idea?Qt Code:
graphicsView->addThumbnail(thumbnail);To copy to clipboard, switch view to plain text mode
Thanks for any help!
Bookmarks