[Qt-interest] QtConcurrent::run results in random crashes

Justus Best just18 at gmx.de
Wed Jul 28 01:05:22 CEST 2010


Am 27.07.2010 23:53, schrieb Thiago Macieira:
> On Tuesday 27. July 2010 17.18.39 Justus Best wrote:
>>  QPair<QPixmap, QString>  createData(QString file, QSize size)
>>  {
>>          return qMakePair(QPixmap(file).scaled(size), file);
>>  }
>
> Your problem is you're using QPixmap. QPixmap is a GUI element and it cannot
> be used outside the GUI thread.
>

Thanks for that, I really didn't know that using QPixmap outside the 
Main/GUI thread is a problem. I will do the scaling of my thumbnails 
with QImage, I guess this should be thread safe at least if only one 
thread at a time uses the same Image.
Is the conversion from QImage to QPixmap very expensive, if I use a 
QImage whith the same Format as the Pixmap on the current system lets 
say RGB32 on non transparent widgets and ARGB32Premultiplied on 
transparent ones ?

Justus



More information about the Qt-interest-old mailing list