DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

Use QItemDelegate to show image thumbnails

StackOverflow https://stackoverflow.com/questions/24212

Question

What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view?

Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)?

Can anyone link to some example code that achieves this? Then again, perhaps this isn't the place to look for Qt-specific code.

Solution

You're doing it wrong if you are generating pixmaps inside any of the delegate methods (paint, draw...).
Try to generate the thumbnails only once (on worker thread or maybe not even at runtime, if possible) and have the delegate just display them for the appropriate role.
If you do it at runtime display a default picture until you have the thumbnail generated (like web browsers do with pictures that are not yet downloaded).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow