diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-12-21 11:32:43 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-02 10:44:00 +0100 |
commit | ef60ed1c9dbc87d9f8401036cc254a9c45cd8ca8 (patch) | |
tree | 8a2016d4fc1ec5d6c3caed14cb1b9467895aa1ef /src/corelib/global | |
parent | 05ca21411eaaf3ea5e9cc9d82ecfaa8753f9f319 (diff) |
Add Qt::TimerType and the QTimer::timerType property
The timer type will control the accuracy of the timer. By default, all
timers are CoarseTimers, which allows for +/- 5% interval adjustment.
PreciseTimers will not have any interval adjustments, VeryCoarseTimers
will have intervals adjusted to full second resolution.
Use QTimer::setTimerType() or the QTimer::singleShot() overload to
specify the type.
QObject::startTimer() now takes a Qt::TimerType argument which defaults
to Qt::CoarseTimer. QBasicTimer::startTimer() gets an overload that
takes a Qt::TimerType argument. The argument is unused for now, since
the QAbstractEventDispatcher interface needs to change (done in a
separate commit).
Author: Thiago Macieira <thiago.macieira@nokia.com>
Change-Id: I3100da5aa1fe17ec30b8644897d0fe6ec4a07f52
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qnamespace.h | 7 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 4c0b9cc635..1927323ea7 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -97,6 +97,7 @@ Qt { Q_ENUMS(GestureType) #endif Q_ENUMS(CursorMoveStyle) + Q_ENUMS(TimerType) #endif // defined(Q_MOC_RUN) #if defined(Q_MOC_RUN) @@ -1527,6 +1528,12 @@ public: LogicalMoveStyle, VisualMoveStyle }; + + enum TimerType { + PreciseTimer, + CoarseTimer, + VeryCoarseTimer + }; } #ifdef Q_MOC_RUN ; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 4abe981b59..20ae1baa80 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2865,3 +2865,13 @@ \sa QApplication::setNavigationMode() \sa QApplication::navigationMode() */ + +/*! + \enum Qt::TimerType + + The timer type indicates how accurate a timer can be. + + \value PreciseTimer Precise timers try to keep millisecond accuracy + \value CoarseTimer Coarse timers try to keep accuracy within 5% of the desired interval + \value VeryCoarseTimer Very coarse timers only keep full second accuracy +*/ |