View Full Version : QT equivalent of glutIdleFunc(..)
virtualchetan
09-24-2003, 11:07 AM
Hi,
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
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);
timer.start(0,false);
connect(&timer,SIGNAL(timeout()),mywindow,SLOT(idle));
The idea is to launch a timer with 0 timeout. The slot will be called when the widget has no user event to process.
virtualchetan
09-24-2003, 11:36 AM
Tayo,
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
SirKnight
09-24-2003, 11:37 AM
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.
-SirKnight
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.