[Qt-interest] QPainter: It is not safe to use drawPixmap() outside the GUI thread

Andre Somers andre at familiesomers.nl
Wed Oct 28 12:50:30 CET 2009


Serge wrote:
> Hello,
>
> I have QT application, which renders SVG on QPixmap in a separate 
> thread. Separate thread is needed because rendering takes a lot of time.
> this application was developed in QT 4.3.3
> it worked fine without warnings.
>
> now i built it in QT 4.5.2
> when it works in debug output window i can see a lot of messages:
> QPainter: It is not safe to use drawPixmap() outside the GUI thread
>
> Is it critical warning?
>   
Yes. Don't do GUI painting outside the GUI thread. Ever.
> Can i leave rendering the same or i need to rewrite rendering so that it 
> would not use QPixmap? What thread-safe alternative of using QPixmap?
>   
Try rendering into a QImage, and paint that on the pixmap in the GUI thread.

André




More information about the Qt-interest-old mailing list