View Full Version : setting image to QLabel in new thread

3rd September 2008, 05:59
I'm extending QFileDialog with preview support. When user clicked on the graphic file, image must be set to the QLabel. I doing it in new thread because loading big images is slow sometimes.
QPixmap is not supported to creating in new threads. I'm loading file in QPicture:

QPicture *pic = new QPicture;
But it returned warning to console:

QPicturePaintEngine::checkFormat: Incorrect header
and file is not loaded.
Can't anybody help me with this problem?

P.S. Sorry for my English.

3rd September 2008, 08:41
you can try to load data from file in thread in QByteArray and then emit a signal which will return this QByteArray and then in GUI you can create QPIxmap.
if you need example I can show it.

3rd September 2008, 09:20
Use QImage and not QPicture.