views:

1052

answers:

1

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...

+3  A: 

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).

kokos