Qt World Summit: Register Today!

QGLWidget update(rect) always returns entire rect in paintEvent

  • I have a simple painting app using a QGLWidget that I am calling update(rect) on, passing in a rect that is much smaller than the rect of the QGLWidget. I use a QImage to draw into, and then in the paintEvent, I draw a portion of that to the QGLWidget. When I put a break point on the paintEvent method, and call event->rect() or event->region().rects(), it returns the entire rect of the QGLWidget. I would have expected it to return only the rect that was passed to the update method.

    As a consequence, drawing on my iPhone is horribly laggy.

    Here is my code: http://pastebin.com/beyyHCPw

    If you scroll to the bottom of the pastebin, you will see my logging code where I am logging which rect I draw (draw rect) to and then later which rect comes back in the paint event (update rect).

Log in to reply