【发布时间】:2010-06-25 11:40:35
【问题描述】:
我有一个包含QGLWidget 和QStatusBar 的窗口。我在 timerEvent 调用中计算 fps,但我不知道在每一帧上更新状态栏的“正确”方式。 fps是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.
}
谢谢!
【问题讨论】: