[Qt-interest] How to draw outside QPaintEvent.
Arnold Krille
arnold at arnoldarts.de
Tue Apr 7 10:31:33 CEST 2009
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090407/da0a982d/attachment.bin
More information about the Qt-interest-old
mailing list