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

Serge mb0 at km.ru
Thu Oct 29 07:00:48 CET 2009


Thank you for all answers.

I want to understand, why i can not use QPixmap from the other thread.

Ander wrote: "Yes. Don't do GUI painting outside the GUI thread. Ever."

Can you please explain or give some links, what is GUI painting? What is 
the difference between GUI painting and non-GUI painting? Why when i use 
QPixmap i use GUI painting?

Mihail Naydenov wrote:
> 
> 
> 
> ----- Original Message ----
>> From: Serge <mb0 at km.ru>
>> To: qt-interest at trolltech.com
>> Sent: Wed, October 28, 2009 1:36:59 PM
>> Subject: [Qt-interest] QPainter: It is not safe to use drawPixmap() outside the GUI thread
>>
>> 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?
>> 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?
> 
> You should use QImage instead.
> 
> Than you can drawImage() or QPixmap::fromImage() if you really need a pixmap (faster onscreen)
> 
> MihailNaydenov
> 
> 
>> Thank you!
>>
>> --
>> Serge
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 
> 
> 
>       

--
Serge



More information about the Qt-interest-old mailing list