Jan 102010
 

Given that most future development by Tamoggemon Software will be done in Qt, it IMHO is only right and due to get a category on Qt here on TamsS60. And, as usual, let’s start out with a rant.

Let’s assume that you have initialized a nice QPainter, try to draw and nothing happens. You then check out the error log, and see an error similar to the one below:

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

In this case, the situation is simple. You are most likely drawing on a QWidget outside of its PaintEvent. Like it or not, but there is no way to draw on a QWidget outside of its paintEvent (unless some special flags are set, which limit compatibility, blah blah)…


Related posts:

  1. Draw on top of a Qt Widget
  2. Long-tap context menus and Qt for Symbian
  3. Asian readers can now peel white paint off their Nokia N76
  4. NTT DoCoMo’s phones to get self-healing paint
  5. Nokia N76 quality problems – welcoming Nokia into the peeling paint pool

  4 Responses to “QPainter::begin: Paint device returned engine == 0, type: 1”

  1. I get the same error message when I use QPainter inside my paintEvent():: My code is::

    void myApp::paintEvent(QPaintEvent *event){
    QPainter painter(imageLabel);
    QRect dirtyRect = event->rect();
    painter.drawImage(dirtyRect, currentFrame->imgQ, dirtyRect);

    }

    Here, “imageLabel” is a QLabel over which a modified part of the QImage “currentFrame->imgQ” is to be painted.

    Can you tell me how to fix this?? or what am I doing wrong??

    Sincerely, Aayush Shrestha

  2. Hi,
    you need to handle the paintEvent of the imagelabel!

    All the best
    Tam Hanna

  3. Hi,
    In my code i use to draw a real time graph outside paintEvent by setting property WA_PaintOutsidePaintEvent to true for qframe. It is plotting properly in my linux desktop as it is having x11. when i ran the same app in my arm based processor for which we have ported qt, i am getting error
    QWidget::paintEngine: Should no longer be called
    QPainter::begin: Paint device returned engine == 0, type: 1

    As my arm environment is not having x11,Is this is the problem to draw outside paint event.

  4. Hi,
    IMHO, one can not draw outside the paint event on ANY OS.

    All the best
    Tam

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting