[Qt-interest] [Qt-Interest] Painting outside paintEvent in QT4.5 : Widget painting can only begin as a result of a paintEvent

Malyushytsky, Alex alex at wai.com
Tue Jun 2 04:20:50 CEST 2009


According to how I see it:

Approach A (simplest)
------------------------------------------------------------------
Instead of painting to the widget, paint to the QPixmap or QImage.
Update the widget when painting done.

+ minimum changes to the paining code.
- sometimes update of the whole widget from image is inefficient and it might be not that easy to implement it efficiently.
   And things got worse when you like to see evolution of the drawing on the screen instead of the result.


Approach B (never tried, but it looks promising, if I don't make any mistake about it functionality)
------------------------------------------------------------------
Paint to QPicture, store QPicture object(s).
Call update when required, use QPicture object to draw in the paint event.

I can't recommend it, cause I never tried, but it seems more powerful.


Best regards,

Alex




-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Thiago Macieira
Sent: Saturday, May 30, 2009 2:52 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] [Qt-Interest] Painting outside paintEvent in QT4.5 : Widget painting can only begin as a result of a paintEvent

shivam priyadarshi wrote:
>I have this kind of code structure at various places in application. I
>have tight schedule, it will be great help if you can help me with make
>it work with QT4.5 with painting outside paintEvent.

You have to refactor your code so that you paint only inside the paintEvent.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
      Sandakerveien 116, NO-0402 Oslo, Norway


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”

“Please consider our environment before printing this email.”




More information about the Qt-interest-old mailing list