path: root/src/plugins
diff options
authorBradley T. Hughes <>2011-12-21 11:33:33 +0100
committerQt by Nokia <>2012-01-02 10:44:00 +0100
commit2bbf9befd8879dcfca9f48ac9ac13daf40f48847 (patch)
tree42457f54a2a25cf2a8de6a9292c60b7513339c4a /src/plugins
parentef60ed1c9dbc87d9f8401036cc254a9c45cd8ca8 (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 <> Change-Id: Ia22697e0ab0847810c5d162ef473e0e5a17a904b Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/plugins')
2 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
index 7184db84fa..688cd75e29 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
@@ -121,7 +121,7 @@ public:
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
- void registerTimer(int timerId, int interval, QObject *object);
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
bool unregisterTimer(int timerId);
bool unregisterTimers(QObject *object);
QList<TimerInfo> registeredTimers(QObject *object) const;
@@ -137,6 +137,7 @@ private:
struct MacTimerInfo {
int id;
int interval;
+ Qt::TimerType timerType;
QObject *obj;
bool pending;
CFRunLoopTimerRef runLoopTimer;
diff --git a/src/plugins/platforms/cocoa/ b/src/plugins/platforms/cocoa/
index 8cdf40be78..d55b28ffcc 100644
--- a/src/plugins/platforms/cocoa/
+++ b/src/plugins/platforms/cocoa/
@@ -139,7 +139,7 @@ void QCocoaEventDispatcherPrivate::activateTimer(CFRunLoopTimerRef, void *info)
-void QCocoaEventDispatcher::registerTimer(int timerId, int interval, QObject *obj)
+void QCocoaEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj)
#ifndef QT_NO_DEBUG
if (timerId < 1 || interval < 0 || !obj) {
@@ -154,6 +154,7 @@ void QCocoaEventDispatcher::registerTimer(int timerId, int interval, QObject *ob
MacTimerInfo *t = new MacTimerInfo();
t->id = timerId;
t->interval = interval;
+ t->timerType = timerType;
t->obj = obj;
t->runLoopTimer = 0;
t->pending = false;
@@ -241,7 +242,7 @@ QCocoaEventDispatcher::registeredTimers(QObject *object) const
while (it != QCocoaEventDispatcherPrivate::macTimerHash.constEnd()) {
MacTimerInfo *t = it.value();
if (t->obj == object)
- list << TimerInfo(t->id, t->interval);
+ list << TimerInfo(t->id, t->interval, t->timerType);
return list;