Hi, I've got a window containing a QGLWidget
and a QStatusBar
. I calculate the fps inside a timerEvent
call, but I don't know the 'correct' way to update the statusbar on every frame. fps
is a member variable of GLWidget
:
void GLWidget::timerEvent(QTimerEvent* event){
updateGL();
// Calculate FPS.
prevTime = currentTime;
currentTime = runTime.elapsed();
int timeDiff = currentTime - prevTime;
fps = 1000.0/timeDiff;
// Update statusbar with fps here.
}
Thanks!