diff options
Diffstat (limited to 'src/widgets/kernel/qshortcut.h')
-rw-r--r-- | src/widgets/kernel/qshortcut.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h index 6c92f87c46..a519a8696a 100644 --- a/src/widgets/kernel/qshortcut.h +++ b/src/widgets/kernel/qshortcut.h @@ -90,7 +90,8 @@ public: template<class Obj1, typename Func1> QShortcut(const QKeySequence &key, QWidget *parent, const Obj1 *object1, Func1 slot1, - Qt::ShortcutContext context = Qt::WindowShortcut) + Qt::ShortcutContext context = Qt::WindowShortcut, + typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0) : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context) { connect(this, &QShortcut::activated, object1, std::move(slot1)); @@ -98,7 +99,8 @@ public: template<class Obj1, typename Func1, typename Func2> QShortcut(const QKeySequence &key, QWidget *parent, const Obj1 *object1, Func1 slot1, Func2 slot2, - Qt::ShortcutContext context = Qt::WindowShortcut) + Qt::ShortcutContext context = Qt::WindowShortcut, + typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0) : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context) { connect(this, &QShortcut::activated, object1, std::move(slot1)); @@ -108,7 +110,9 @@ public: QShortcut(const QKeySequence &key, QWidget *parent, const Obj1 *object1, Func1 slot1, const Obj2 *object2, Func2 slot2, - Qt::ShortcutContext context = Qt::WindowShortcut) + Qt::ShortcutContext context = Qt::WindowShortcut, + typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0, + typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj2*>::Value>::type* = 0) : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context) { connect(this, &QShortcut::activated, object1, std::move(slot1)); |