Sure thing, I can line it out a bit. But keep in mind it comes out of my head, it's been a while since I touched this.
So if I recall correctly each item in the asset list had some arbitrary data. One property contained the file path to the asset. Once an item came into view (by users scrolling the list or by "jumping" to an item from the search filters) a thread was started which read the file path from that certain item, collected its texture preview image and put into a QPixmap. During that the item showed just a busy indicator (hourglass or similar). As soon as the thread had finished preparing a preview thumbnail it emitted a signal which made the target item switch from the busy indicator to the real preview pixmap.
You don't have to spawn a thread for each item but rather have one background thread running and doing this for all visible items. Preview images from items that moved out of sight can be kept in memory respectively serve as an image cache, but you could also free them up. Decide yourself on the latter.
Hope this helps. Let me know if you need more details.




Reply With Quote

Bookmarks