[Interest] QTimer at 30Hz interval?

Konstantin Shegunov kshegunov at gmail.com
Wed Apr 4 09:54:50 CEST 2018

Just an idea:
I believe by default QTimer doesn't have that fidelity, however you can
check if your platform supports Qt::PreciseTimer and stagger two of them,
one at 30 ms, and one at 31 ms. Both would go to one handler, where you
check if the timeout has expired and trigger the needed slot on demand.

On Wed, Apr 4, 2018 at 10:33 AM, Ola Røer Thorsen <ola at silentwings.no>

> is there some nice trick to make a QTimer trigger at 30 Hz? This interval
> can't be expressed properly in milliseconds (1000/30 = 33.333333...)
> My use case is for Linux only so I'd be happy with some Linux-specific way
> of triggering a signal at 30 Hz too. It won't have to be very precise for
> each trigger as long as the average frequency is 30 Hz.
> Cheers,
> Ola
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180404/aa8e17fd/attachment.html>

More information about the Interest mailing list