Unsolved QTimer issue on iOS
-
Hi!
As part of my iOS app, I am using a QTimer object to call a method every X milliseconds. Nothing out of this world:
timer->start(milliseconds);
I have been testing the same code either in Android and Windows and the performance of the timer is accurate. My problem occurs specifically in iOS, where the method called by the timer is executed with a constant interval of time, in despite of the value I set for the milliseconds variable.
Is there any reference about considerations of using QTimer variables or real time resources in iOS?
Thanks.
-
@xtingray how are you setting your milliseconds exactly ?
-
My implementation is about a player of a sequence of images simulating an animation reproducer.
play(int fps) { int milliseconds = 1000/fps; timer->start(milliseconds); }
fps is a value between 1 and 50. As I said before this works perfect in Android and Windows.
-
Hi,
You can try to change the timer type for
Qt::PreciseTimer
check the implication for doing so. -
I tried your advice with no luck:
timer = new QTimer(this); timer->setTimerType(Qt::PreciseTimer); connect(timer, &QTimer::timeout, this, &Reproducer::play);
The difference is quite evident comparing Android performance vs iOS. Same code.
-
@xtingray said in QTimer issue on iOS:
My implementation is about a player of a sequence of images simulating an animation reproducer.
play(int fps) { int milliseconds = 1000/fps; timer->start(milliseconds); }
looks good. I remember problems where - in qml - setting the timeout as x*60 or so could cause problems
have overlooked that you're doing it from c++will verify if my timers are working correct on iOS
-
Hi,
I've got the same issue. Is there a solution?
Best regards,
Morfio
-
Oh, I'm sorry. It's not a timer problem. It's a QPixmapItem::setPosition problem. If I set the the x position (maybe QPixmapItem::position()x() + 10) it slows down the framerate from ~77 to ~8. Does anyone know, why? On Windows, FreeBSD and Android it works great.
-
@Morfio I didn't mean QPixmapItem: QGraphicsPixmapItem