diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-12-21 11:33:33 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-02 10:44:00 +0100 |
commit | 2bbf9befd8879dcfca9f48ac9ac13daf40f48847 (patch) | |
tree | 42457f54a2a25cf2a8de6a9292c60b7513339c4a /src/corelib/kernel/qabstracteventdispatcher.cpp | |
parent | ef60ed1c9dbc87d9f8401036cc254a9c45cd8ca8 (diff) |
Add Qt::TimerType argument to QAbstractEventDispatcher::registerTimer()
... and deprecate the old registerTimer() functions. The new pure-
virtual registerTimer() breaks source-compatibility. Subclasses cannot
be instantiated anymore, since the pure virtual function signature has
changed.
QAbstractEventDispatcher::TimerInfo is no longer a QPair. It is now a
struct with timerId, interval, and timerType members. This is a source
incompatibility that should only affect subclasses of
QAbstractEventDispatcher, which will need to pass 3 arguments to the
TimerInfo constructor instead of 2. If the subclass used QPair<int,int>
instead of the TimerInfo typedef, the QPair<int,int> declarations will
need to be replaced with TimerInfo.
Call the new registerTimer() function with the type from
QObject::startTimer(). Change all subclasses of QAbstractEventDispatcher
to reimplement the new virtual function. The type argument is unused at
the momemnt, except to ensure that registeredTimers() returns the type
each timer was registered with. Implementations for the various
dispatchers will be done in separate commits.
Author: Thiago Macieira <thiago.macieira@nokia.com>
Change-Id: Ia22697e0ab0847810c5d162ef473e0e5a17a904b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qabstracteventdispatcher.cpp')
-rw-r--r-- | src/corelib/kernel/qabstracteventdispatcher.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index b936ac4ed2..910b2908f1 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -230,22 +230,39 @@ QAbstractEventDispatcher *QAbstractEventDispatcher::instance(QThread *thread) */ /*! + \obsolete + \fn int QAbstractEventDispatcher::registerTimer(int interval, QObject *object) - Registers a timer with the specified \a interval for the given \a object. + Registers a timer with the specified \a interval for the given \a object + and returns the timer id. +*/ + +/*! + \obsolete + + \fn void QAbstractEventDispatcher::registerTimer(int timerId, int interval, QObject *object) + + Register a timer with the specified \a timerId and \a interval for the + given \a object. +*/ + +/*! + Registers a timer with the specified \a interval and \a timerType for the + given \a object and returns the timer id. */ -int QAbstractEventDispatcher::registerTimer(int interval, QObject *object) +int QAbstractEventDispatcher::registerTimer(int interval, Qt::TimerType timerType, QObject *object) { int id = QAbstractEventDispatcherPrivate::allocateTimerId(); - registerTimer(id, interval, object); + registerTimer(id, interval, timerType, object); return id; } /*! - \fn void QAbstractEventDispatcher::registerTimer(int timerId, int interval, QObject *object) + \fn void QAbstractEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) - Register a timer with the specified \a timerId and \a interval for - the given \a object. + Register a timer with the specified \a timerId, \a interval, and \a + timerType for the given \a object. */ /*! @@ -269,8 +286,10 @@ int QAbstractEventDispatcher::registerTimer(int interval, QObject *object) /*! \fn QList<TimerInfo> QAbstractEventDispatcher::registeredTimers(QObject *object) const - Returns a list of registered timers for \a object. The timer ID - is the first member in each pair; the interval is the second. + Returns a list of registered timers for \a object. The TimerInfo struct has + \c timerId, \c interval, and \c timerType members. + + \sa Qt::TimerType */ /*! \fn void QAbstractEventDispatcher::wakeUp() |