diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-04-22 12:40:01 +0200 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2017-04-29 08:24:18 +0000 |
commit | a6c091c2d18f6e7f849da7dfa3bd1971017fca73 (patch) | |
tree | 4a8e1734e2ad31a44c9ec4d6779de759150bb159 /src/corelib/kernel/qobject.h | |
parent | 779c00d454345ad51ee77572f6349a49af0647dd (diff) |
Support move-only function objects in QObject::connect
[ChangeLog][QtCore][QObject] Added connect() support for move-only
function objects.
Task-number: QTBUG-60339
Change-Id: Iae5e48432bb64517b0607b0c2ba23931957f432e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qobject.h')
-rw-r--r-- | src/corelib/kernel/qobject.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 6941c55896..2e66daa914 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -304,7 +304,7 @@ public: static inline typename std::enable_if<QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1, QMetaObject::Connection>::type connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot) { - return connect(sender, signal, sender, slot, Qt::DirectConnection); + return connect(sender, signal, sender, std::move(slot), Qt::DirectConnection); } //connect to a functor, with a "context" object defining in which event loop is going to be executed @@ -334,7 +334,7 @@ public: return connectImpl(sender, reinterpret_cast<void **>(&signal), context, Q_NULLPTR, new QtPrivate::QFunctorSlotObject<Func2, SlotArgumentCount, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value, - typename SignalType::ReturnType>(slot), + typename SignalType::ReturnType>(std::move(slot)), type, types, &SignalType::Object::staticMetaObject); } #endif //Q_QDOC |