QObject timer events happening in reverse order

  • If I create a slew of timers, all with the same interval, and their scheduled time ends up being on the same tick of whatever clock they are scheduled against, they fire their events in the reverse order. Doesn't this seem Very Wrong? Does anyone know a way around this? I'm using 5.12 RC2 on Windows.

  • Qt Champions 2017

    what is the way around are you looking for ? Are you using timerEvent(..) or QTimer ?.

  • Moderators

    @pderocco I actually wouldn't expect any specific order if all timers fire at the same time. Why is the order important to you? And why do you have several timers with same interval?

  • I'm using QObject::startTimer(), and defining my own virtual QOBJECT::timerEvent(). They're part of a simple system by which I can launch a function to be called in a certain amount of time. I'm trying to simulate a comm link that has a delay, so I want things to "get there" after a certain amount of time, but certainly in the same order that I sent them. The easiest way to implement this is to create a timer for each message I send, and kill the timer when it arrives. I catalog the function to be called as a numbered property of a common schedule object, indexed by the timer id, and delete the property after calling the function in timerEvent. It all works just peachy, except that it appears that when they are scheduled on the same timer tick, they are perversely pushed onto a stack rather than into a queue.

    Since they just released the official 5.12, I'm going to install that and see if there's any difference.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.