diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 6f5d574f705..6a8088ef129 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -285,7 +285,10 @@ public: //connect to a functor template - static inline typename std::enable_if::ArgumentCount == -1, QMetaObject::Connection>::type + static inline typename std::enable_if< + QtPrivate::FunctionPointer::ArgumentCount == -1 && + !std::is_convertible_v, // don't match old-style connect + QMetaObject::Connection>::type connect(const typename QtPrivate::FunctionPointer::Object *sender, Func1 signal, Func2 slot) { return connect(sender, signal, sender, std::move(slot), Qt::DirectConnection); @@ -293,7 +296,10 @@ public: //connect to a functor, with a "context" object defining in which event loop is going to be executed template - static inline typename std::enable_if::ArgumentCount == -1, QMetaObject::Connection>::type + static inline typename std::enable_if< + QtPrivate::FunctionPointer::ArgumentCount == -1 && + !std::is_convertible_v, // don't match old-style connect + QMetaObject::Connection>::type connect(const typename QtPrivate::FunctionPointer::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type = Qt::AutoConnection) {