diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2023-06-27 18:29:38 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2023-08-24 07:45:04 +0200 |
commit | a7d2855b3c7716467c827f27359259afb5c4cbea (patch) | |
tree | b3130eeed1d0af9ac371715f7c35215472ec1346 /src/corelib/compat | |
parent | 777a1ed19185c594d7f43296e0044e3e354690ca (diff) |
invokeMethod: enable passing parameters to overload taking functors
This was missing for a while, and there is nothing fundamentally
missing for it to work.
With the more recent work around slot objects and invokeMethod in
general, it is a good time to add support for this.
In this patch, when connecting to a functor, it automatically deduces
the overload to call based on the arguments passed to invokeMethod.
Sharing code with QObject::connect could be done, but they have a
key difference that makes it harder:
With signal emissions we throw away trailing arguments that are not
used: i.e. `signal(int, int)` can be connected to `slot(int)` or
`slot()`. With invokeMethod that's not a thing. So we will need a way
to toggle that behavior during resolution.
[ChangeLog][QtCore][QMetaObject] Added support for passing parameters
to the overload of QMetaObject::invokeMethod that takes a functor. These
new overloads must have the return-value passed through qReturnArg().
Change-Id: If4fcbb75515b19e72fab80115c109efa37e6626e
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/compat')
-rw-r--r-- | src/corelib/compat/removed_api.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index 088b418aef..a504bef17d 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -635,6 +635,13 @@ QString QLocale::bcp47Name() const return bcp47Name(TagSeparator::Dash); } +#include "qobjectdefs.h" + +bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type, void *ret) +{ + return invokeMethodImpl(object, slot, type, 1, &ret, nullptr, nullptr); +} + #include "qurl.h" QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode) |