[PyKDE] QIconView to display Thumbnails.

Gordon Tyler gordon at doxxx.net
Fri Jan 10 21:19:01 GMT 2003


Olivier Roulet wrote:
> pyqt3.4 and python2.2.1 qt3.01 , linux
>  
> I am using QIconView in a small program to display
> thumbnails of all pictures in a directory.
> Since it takes quite  long to generate the thumbnails
> I first create the IconView and then I use
>  a queue in a different thread  to post events to
> create the thumbnails one by one

I implemented a very similar application in a slightly different way:

On the main Qt thread (i.e. in response to a Qt event) I create all the 
QListViewItem objects for all the images with a placeholder icon (a big 
question mark)

Then on a separate thread, I then go through the files, load the image, 
create the thumbnail (or load from cache) and update the QListViewItem's 
icon with the new image. All with the appropriate QApplication.lock and 
unlock calls.

It took me a few tries before I got it to work without randomly 
segfaulting ;)

Ciao,
Gordon




More information about the PyQt mailing list