qt-interest@trolltech.com
[Top] [All Lists]

Re: [Qt-interest] [Qt-Interest] Painting outside paintEvent in QT4.5 : W

Subject: Re: [Qt-interest] [Qt-Interest] Painting outside paintEvent in QT4.5 : Widget painting can only begin as a result of a paintEvent
From: "Scott Aron Bloom"
Date: Mon, 1 Jun 2009 19:48:39 -0700
Use QImage, QPicture is designed for saving the commands to a file...

QImage is designed for exactly what you are trying to do...

QImage img;
QPainter painter( &img )

Do the painting, then call update()

Scott

> -----Original Message-----
> From: qt-interest-bounces@xxxxxxxxxxxxx [mailto:qt-interest-
> bounces@xxxxxxxxxxxxx] On Behalf Of Malyushytsky, Alex
> Sent: Monday, June 01, 2009 7:21 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Re: [Qt-interest] [Qt-Interest] Painting outside paintEvent in QT4.5
> : Widget painting can only begin as a result of a paintEvent
> 
> 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@xxxxxxxxxxxxx [mailto:qt-interest-
> bounces@xxxxxxxxxxxxx] On Behalf Of Thiago Macieira
> Sent: Saturday, May 30, 2009 2:52 PM
> To: qt-interest@xxxxxxxxxxxxx
> 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.â
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest@xxxxxxxxxxxxx
> http://lists.trolltech.com/mailman/listinfo/qt-interest

_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest
<Prev in Thread] Current Thread [Next in Thread>