Results 1 to 5 of 5

Thread: Error Message "QPainter::begin: Paint device returned engine == 0, type: 1"

  1. #1
    Join Date
    Dec 2008
    Posts
    68

    Default Error Message "QPainter::begin: Paint device returned engine == 0, type: 1"

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Error Message "QPainter::begin: Paint device returned engine == 0, type: 1"

    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?
    Last edited by high_flyer; 24th February 2011 at 10:35.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Dec 2008
    Posts
    68

    Default Re: Error Message "QPainter::begin: Paint device returned engine == 0, type: 1"

    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,

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Error Message "QPainter::begin: Paint device returned engine == 0, type: 1"

    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
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Platforms
    Unix/X11 Windows

    Default Re: Error Message "QPainter::begin: Paint device returned engine == 0, type: 1"

    also check if
    Qt Code:
    1. pixmap2.isNull()
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 5
    Last Post: 15th December 2010, 03:54
  2. Replies: 5
    Last Post: 20th October 2009, 08:18
  3. Replies: 2
    Last Post: 26th January 2009, 23:03
  4. "Treat wchar_t as Built-in Type" to "yes" link error
    By sungaoyong in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 12:45
  5. paint device returned engine == 0, type: 3
    By MarkoSan in forum Qt Programming
    Replies: 14
    Last Post: 12th December 2007, 11:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.