Precise timers will also never time out earlier than expected.įor Qt::CoarseTimer and Qt::Ver圜oarseTimer types, QTimer may wake up earlier than expected, within the margins for those types: 5% of the interval for Qt::CoarseTimer and 500 ms for Qt::Ver圜oarseTimer.Īll timer types may time out later than expected if the system is busy or unable to provide the requested accuracy. ![]() For Qt::PreciseTimer, QTimer will try to keep the accuracy at 1 millisecond. The accuracy also depends on the timer type. Most platforms support a resolution of 1 millisecond, though the accuracy of the timer will not equal this resolution in many real-world situations. The accuracy of timers depends on the underlying operating system and hardware. This is the traditional way of implementing heavy work in GUI applications, but as multithreading is nowadays becoming available on more and more platforms, we expect that zero-millisecond QTimer objects will gradually be replaced by QThreads. It should be written in such a way that it always returns quickly (typically after processing one data item) so that Qt can deliver events to the user interface and stop the timer as soon as it has done all its work. Connect(timer, & QTimer ::timeout, this, &Foo ::processOneThing) įrom then on, processOneThing() will be called repeatedly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |