PDA

View Full Version : Error Message "QPainter::begin: Paint device returned engine == 0, type: 1"



richardander
23rd February 2011, 23:17
Hello,

when running my application in Debug mode of VS2008, there is output

QPainter::begin: Paint device returned engine == 0, type: 1


In source code, QPainter objects have never called begin(). Could anyone help?

Thanks

high_flyer
24th February 2011, 10:05
In source code, QPainter objects have never called begin().
begin() is being called by the following constructor:
http://doc.trolltech.com/4.7/qpainter.html#QPainter-2

Are you painting in other threads than the main thread?

richardander
24th February 2011, 21:10
Hello,

I noticed that each time the program execute following line,

bitBlt( m_Label, QPoint(0,0), &pixmap2 );

the error message shows in output: "QPainter::begin: Paint device returned engine == 0, type: 1"

Both m_Label ( a QLabel object) and pixmap2 (a QPixmap object) are valid.

Is there any suggestion? BTW, I am using QT4.6.

Thank you,

high_flyer
25th February 2011, 09:54
Is there any suggestion?
Yes, please answer my question in my previous post.

Also, the fact you are suing bitBlt() in Qt4.X is a sign for trouble!
It looks to me you are trying to paint outside a paintEvent() which is a "no no" in Qt4.x

totem
25th February 2011, 10:01
also check if
pixmap2.isNull()