Use QItemDelegate to display image thumbnails

What is the best way to use QT4 QItemDelegate to show thumbnails of images in a view?

In particular, how to stop the delegate element from being locked when generating raster images from very large image files (> 500 MB)?

Can anyone refer to some kind of sample code that achieves this? Again, perhaps this is not the place to look for Qt specific code ...

+3
source share
1 answer

You do it wrong if you generate pixmaps inside any of the delegate methods (draw, draw ...).
Try to generate thumbnails only once (in a workflow or maybe not even at runtime), and the delegate simply displays them for the corresponding role.
If you do this at runtime, show the default image until a thumbnail has been created (for example, web browsers will not be loaded with pictures that are not already loaded).

+4
source

Source: https://habr.com/ru/post/1696512/


All Articles