[Qt-interest] Does QCoreApplication::processEvents() update timers?
Karol Krizka
kkrizka at gmail.com
Sun Apr 26 09:23:26 CEST 2009
Hi all,
I am using a third party 3D engine to draw a scene in a QGLWidget. The
scene is quite big, so it takes a while to load, so I want to show some kind
of an animation while it loads. However, the engine is not thread safe, so I
cannot do the loading in one thread and drawing in another. What I would like
to do instead is to redrew the scene after each major component has been
loaded. It will be a bit choppy, but better than nothing.
I'm trying to accomplish this by having my drawing done inside a timer loop
and call QApplication::processEvents(). Basically, I started a timer with
QObject::startTimer() inside the QGLWidget and inside it I call updateGL().
I'm hoping that when I call processEvents(), it will call timerEvent() every
while in order to trigger the redraw. However that does not happen. The
timerEvent() is not called at all during the loading stage.
So my question is, does QApplication::processEvents() also update any
running timers?
Also, since I need to start the loading stage after the widget has been
shown. I cannot do it during QGLWidget::initializeGL(), because that is called
before the widget is visible and so it will prevent the widget from being
displayed. The same problem is by doing it inside QWidget::showEvent(),
which is also called before the widget is visible. So I've decided to start
the loading stage the first time the timerEvent() function is called. Could
that be related to the problem I'm having?
--
Cheers,
Karol Krizka
http://www.krizka.net
More information about the Qt-interest-old
mailing list