[Qt-interest] How to draw outside QPaintEvent.

sathya tej ragesathya at gmail.com
Tue Apr 7 11:29:21 CEST 2009


Thank you Arnold.
Your advice helped.
Thanks Again :D

On Tue, Apr 7, 2009 at 2:01 PM, Arnold Krille <arnold at arnoldarts.de> wrote:

> Hi,
>
> On Tuesday 07 April 2009 09:49:10 sathya tej wrote:
> > I need to draw circles out side QPaintEvent.
>
> Big question: Why?
>
> Why not store the information on which circles to paint inside your class
> and
> use that information during the paint event?
> This would probably have a nice side-effect: Your circles also get
> re-painted
> when the window was covered and is uncovered again. If you paint by hand
> outside the paintEvent and without storing the information about the
> circles,
> your circles would vanish...
>
> > Please tell me when  *void paintEvent(QPaintEvent *event) *is called by
> Qt.
> > Will it be called only once or can it be called multiple times.
>
> You can call update() or repaint() as often as you like. But be aware that
> the
> event-loop compresses multiple paint events into one if they are to close
> to
> each other. (A feature I wish would be usable for other (custom) events
> too.)
>
> You can also call paintEvent directly with either 0x0 or an artificial
> QPaintEvent as argument. But this could actually lead to problems, I
> haven't
> tried it...
>
> Have fun,
>
> Arnold
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>


-- 
whatever happens happens for GOOD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090407/91c72bfb/attachment.html 


More information about the Qt-interest-old mailing list