My QT application relies upon TimerEvent (startTimer/killTimer) to animation GUI components. Recently, however, I compiled and ran my app on my Mac laptop (as opposed to the Windows desktop computer I was developing on) and found that now everything appears to run/update at half the speed it usually does.
The application is not lagging, it simply appears that the update rate is less frequent than what is was originally. What should I do to guarantee consistent timing with the application on all platforms?
Alternatively, should I be using a different feature for temporary timer events? I would prefer not to, as TimerEvent is unbelievably convenient for integrating update cycles into Widgets, but would be interested if they provide consistent timing.
(basic example code for context):
// Once MyObject is created, counts to 20.
// The time taken is noticeably different on each platform though.
class MyObject: public QObject {
public:
MyObject() {
timerId = startTimer(60);
}
protected:
void timerEvent(QTimerEvent* event) {
qDebug() << (counter++);
if(counter == 20) {
killTimer(timerId);
}
Object::timerEvent(event);
}
private:
int timerId = -1, counter = 0;
}