View Full Version : QT equivalent of glutIdleFunc(..)

09-24-2003, 12:07 PM

May be this is a QT question,
I am trying to convert my Glut program to a QT widget (using QGLWidget)

I replaced all glut functions with corresponding QT functions except one - glutIdleFunc(...). Does nebbody know, how to replace this function when using QT instead of GLUT for an openGL application.

- Chetan

09-24-2003, 12:19 PM
This is obviously a QT question.
In QT, you don't have any idle func but you can emulate this using a QTimer.
The code looks like this :
QTimer* timer = new QTimer(mywindow);

The idea is to launch a timer with 0 timeout. The slot will be called when the widget has no user event to process.

09-24-2003, 12:36 PM

Thanx for ur reply.
I found a similar solution in QT examples,

Override QGLWidget::timerEvent(QTimerEvent *);
In the constructor start the timer with inteval
'0' and call updateGL(), in timerEvent(..)

This way, we dont have to create a QTimer instance and connect it to QGLWidget.

- Chetan

09-24-2003, 12:37 PM
Hmm...I thought there was a Qt message board on trolltech.com but I just visited and did not see one. I think they need a message board on trolltech, it would help a lot.