[Development] QTimer question

Jaroslaw Kobus Jaroslaw.Kobus at qt.io
Mon May 29 20:40:14 CEST 2023


Hi All,

when I start 2 single shot timers synchronously in a row, with exactly the same interval, from the same thread, can I rely on having their handlers called in the same order in which they were started?

I.e.:

QTimer::singleShot(1000, [] { qDebug() << "1st timer elapsed"; });
QTimer::singleShot(1000, [] { qDebug() << "2nd timer elapsed"; });

Should I always see the:

1st timer elapsed
2nd timer elapsed

on the output, or should I expect the random order?

Asking here, since I can't find the answer in Qt docs.

Br,

Jarek


More information about the Development mailing list