summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qtimer.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2012-09-13 19:23:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-19 16:13:39 +0200
commitd95d5bfd0732b9739953512ee22f1d3281990c72 (patch)
tree8afb862caa2d7975c9687e6eeb6b1dace581717f /src/corelib/kernel/qtimer.cpp
parent8e3e34defd0e19d49be090046ba76decc2adb526 (diff)
Make QTimer::singleShot take a pointer-to-const QObject
The obvious idea is that a connect() happens behind the scenes. As QObject::connect takes a pointer-to-const, singleShot should do that as well. Change-Id: I36433c723441294b2088b23f0c37724ab43d9503 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qtimer.cpp')
-rw-r--r--src/corelib/kernel/qtimer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 6c89e52b6f..af1d7963e0 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -257,14 +257,14 @@ class QSingleShotTimer : public QObject
int timerId;
public:
~QSingleShotTimer();
- QSingleShotTimer(int msec, Qt::TimerType timerType, QObject *r, const char * m);
+ QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char * m);
Q_SIGNALS:
void timeout();
protected:
void timerEvent(QTimerEvent *);
};
-QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, QObject *receiver, const char *member)
+QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member)
: QObject(QAbstractEventDispatcher::instance())
{
connect(this, SIGNAL(timeout()), receiver, member);
@@ -312,7 +312,7 @@ void QSingleShotTimer::timerEvent(QTimerEvent *)
\sa start()
*/
-void QTimer::singleShot(int msec, QObject *receiver, const char *member)
+void QTimer::singleShot(int msec, const QObject *receiver, const char *member)
{
// coarse timers are worst in their first firing
// so we prefer a high precision timer for something that happens only once
@@ -334,7 +334,7 @@ void QTimer::singleShot(int msec, QObject *receiver, const char *member)
\sa start()
*/
-void QTimer::singleShot(int msec, Qt::TimerType timerType, QObject *receiver, const char *member)
+void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member)
{
if (receiver && member) {
if (msec == 0) {
@@ -345,7 +345,7 @@ void QTimer::singleShot(int msec, Qt::TimerType timerType, QObject *receiver, co
return;
}
QByteArray methodName(member+1, bracketPosition - 1 - member); // extract method name
- QMetaObject::invokeMethod(receiver, methodName.constData(), Qt::QueuedConnection);
+ QMetaObject::invokeMethod(const_cast<QObject *>(receiver), methodName.constData(), Qt::QueuedConnection);
return;
}
(void) new QSingleShotTimer(msec, timerType, receiver, member);