From 2bbf9befd8879dcfca9f48ac9ac13daf40f48847 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 21 Dec 2011 11:33:33 +0100 Subject: 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 instead of the TimerInfo typedef, the QPair 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 Change-Id: Ia22697e0ab0847810c5d162ef473e0e5a17a904b Reviewed-by: Thiago Macieira --- src/corelib/kernel/qeventdispatcher_win.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib/kernel/qeventdispatcher_win.cpp') diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index afee536d02..58a927969c 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -859,7 +859,7 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier) d->doWsaAsyncSelect(sockfd); } -void QEventDispatcherWin32::registerTimer(int timerId, int interval, QObject *object) +void QEventDispatcherWin32::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) { if (timerId < 1 || interval < 0 || !object) { qWarning("QEventDispatcherWin32::registerTimer: invalid arguments"); @@ -875,6 +875,7 @@ void QEventDispatcherWin32::registerTimer(int timerId, int interval, QObject *ob t->dispatcher = this; t->timerId = timerId; t->interval = interval; + t->timerType = timerType; t->obj = object; t->inTimerEvent = false; t->fastTimerId = 0; @@ -953,7 +954,7 @@ QEventDispatcherWin32::registeredTimers(QObject *object) const for (int i = 0; i < d->timerVec.size(); ++i) { const WinTimerInfo *t = d->timerVec.at(i); if (t && t->obj == object) - list << TimerInfo(t->timerId, t->interval); + list << TimerInfo(t->timerId, t->interval, t->timerType); } return list; } -- cgit v1.2.3