diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-12-22 14:45:04 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-01-02 21:50:34 +0100 |
commit | 3fd3a2a9d06505d549cc4a7c18819a17c6622dfd (patch) | |
tree | aa266f8c45a9f81537a3820223f04387e57ddeb1 /src/qml/jsruntime/qv4executablecompilationunit_p.h | |
parent | e39b4572c272f8a0a7be048a24808cb028480e82 (diff) |
QObjectWrapper: Fix calling attached methods on different objects
You can generally store a method in a value and call it on a different
object. However, since we've ignored the thisObject basically forever,
we cannot just accept it right away. Add an opt-in mechanism via a
pragma that allows you to pass (implicitly via context or explicitly via
call()) specific thisObjects to QObject methods.
Fixes: QTBUG-109585
Pick-to: 6.5
Change-Id: I4c81b8ecf6317af55104ac9ebb62d98862ff24e7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit_p.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit_p.h b/src/qml/jsruntime/qv4executablecompilationunit_p.h index bb99040b9a..0b27e68a20 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit_p.h +++ b/src/qml/jsruntime/qv4executablecompilationunit_p.h @@ -171,6 +171,11 @@ public: return data->flags & CompiledData::Unit::FunctionSignaturesEnforced; } + bool nativeMethodsAcceptThisObjects() const + { + return data->flags & CompiledData::Unit::NativeMethodsAcceptThisObject; + } + int objectCount() const { return qmlData->nObjects; } const CompiledObject *objectAt(int index) const { |