diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2015-07-26 14:45:49 +0200 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2015-07-27 06:05:35 +0000 |
commit | 4c3c6bab302b610ce0457f96fd0a04842d25b692 (patch) | |
tree | 80273da36f4e6a92d9f93089827884cbbdb03547 | |
parent | a1bfa3965102972323a1f6407036df3f65dcce2c (diff) |
QTimer: Force a compilation error with pmf without object
None of this should compile (foo is non-static):
QTimer::singleShot(0, &TestObject::foo);
QTimer::singleShot(0, SLOT(foo()));
Task-number: QTBUG-47426
Change-Id: I54b7d14124459e450c6a0a93a3033f21b57605d9
Reviewed-by: Dario Freddi <dario.freddi@ispirata.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/kernel/qtimer.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index 56f8a1a177..889f5d7f70 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -102,12 +102,16 @@ public: } // singleShot to a functor or function pointer (without context) template <typename Func1> - static inline void singleShot(int msec, Func1 slot) + static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction && + !QtPrivate::is_same<const char*, Func1>::value, void>::Type + singleShot(int msec, Func1 slot) { singleShot(msec, msec >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer, Q_NULLPTR, slot); } template <typename Func1> - static inline void singleShot(int msec, Qt::TimerType timerType, Func1 slot) + static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction && + !QtPrivate::is_same<const char*, Func1>::value, void>::Type + singleShot(int msec, Qt::TimerType timerType, Func1 slot) { singleShot(msec, timerType, Q_NULLPTR, slot); } |