Calcultate fps
-
The example below illustrates how this can be done, it is based on how this is done internally in Qt:
@class FPS : public QWidget
{public:
FPS() : m_frameCount(0) {}void paintEvent(QPaintEvent *e) { if (m_frameCount == 0) { m_time.start(); } else { printf("FPS is %f ms\n", m_time.elapsed() / float(m_frameCount)); } m_frameCount++; // Painting goes here... } QTime m_time; int m_frameCount;
};@