[Interest] When is the QPaintEvent sent?

Till Oliver Knoll till.oliver.knoll at gmail.com
Mon Sep 9 08:37:19 CEST 2013


Am 08.09.2013 um 21:11 schrieb Alexander Syvak <alexander.svk at gmail.com>:

> Thank you, captain.
> But I am interested when the repaint is needed in Qt.

No, you were asking when the paint event is *sent* (see your own subject!) and not when it is *needed* which are two different things!

I already told you when the event is "sent": when Qt thinks there is "a good time to do so"!

For instance you can call QWidget several times in a row, combined with the Window Manager also telling Qt to update (specific region of) a window ("system events") - and you could still get just *one* paint event: the Qt event queue decides itself *when* to sent the paint event. 

My previous answer was deliberately a bit sloppy for at least three reasons:

 a) to match with your sloppy question style ("short, undpecific, question only in the subject, without motivation why you need to know etc.

b) it's actually a RTFM question, e.g. start here:

http://qt-project.org/doc/qt-4.8/qt4-arthur.html

c) But most importantly once you start asking - as an application developer - about the "whens" of certain events then you're mostly up to something *wrong* (or you already do something wrong and wonder about poor performance, e.g. blocking/delaying the Qt event queue in the GUI thread): the "paint" API  is a contract between you and Qt: Qt promises to take care about the paint *events* (but again: *when* or *why* exactly your application receives them is none of your business!), your application promises to do the actual work ("paint").


If on the other hand you are *really* interested about the *interna* of Qt then you are probably better off on the qt developer mailing list.


So long, sailor!
 Captain Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130909/6ed39cfd/attachment.html>


More information about the Interest mailing list