aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4function_p.h
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2022-03-28 10:44:48 +0200
committerUlf Hermann <[email protected]>2022-04-11 14:12:09 +0200
commitec79af7396fd695b25f8f7dba66e8048d54b953b (patch)
tree68c3d2967228cfc8befecec233c87cec4f039f87 /src/qml/jsruntime/qv4function_p.h
parent60d9f0dd737f23ad239bfbdb21573c8a7633a63f (diff)
DelegateModel: Use actual bindings for required properties
Tracking the change signals is brittle and error prone. We have bindings for this case. Let's use them. We can construct a synthetic QV4::Function that contains its own QQmlJSAotFunction. In order to pass the property index to the function we generalize the "index" property of QQmlJSAotFunction to contain any extra data the function may want to use. If there is no compilation unit, we pass that instead. Fixes: QTBUG-91649 Change-Id: I0758bcc4964a48c6818d18bfb0972e67dbc16a1f Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4function_p.h')
-rw-r--r--src/qml/jsruntime/qv4function_p.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h
index 2c5de203b6..8f2a38416d 100644
--- a/src/qml/jsruntime/qv4function_p.h
+++ b/src/qml/jsruntime/qv4function_p.h
@@ -81,9 +81,10 @@ struct Q_QML_EXPORT FunctionData {
Q_STATIC_ASSERT(std::is_standard_layout< FunctionData >::value);
struct Q_QML_EXPORT Function : public FunctionData {
-private:
+protected:
Function(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
const CompiledData::Function *function, const QQmlPrivate::AOTCompiledFunction *aotFunction);
+ Function(ExecutionEngine *engine, const QQmlPrivate::AOTCompiledFunction *aotFunction);
~Function();
public:
@@ -122,8 +123,12 @@ public:
static Function *create(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
const CompiledData::Function *function,
const QQmlPrivate::AOTCompiledFunction *aotFunction);
+ static Function *create(ExecutionEngine *engine,
+ const QQmlPrivate::AOTCompiledFunction *aotFunction);
void destroy();
+ bool isSyntheticAotFunction() const { return codeData == nullptr && aotFunction != nullptr; }
+
// used when dynamically assigning signal handlers (QQmlConnection)
void updateInternalClass(ExecutionEngine *engine, const QList<QByteArray> &parameters);
@@ -151,6 +156,18 @@ public:
}
};
+struct SyntheticAotFunction : public Function
+{
+ SyntheticAotFunction(ExecutionEngine *engine, QQmlPrivate::AOTCompiledFunction aotFunction)
+ : Function(engine, &m_aotFunction)
+ , m_aotFunction(std::move(aotFunction))
+ {
+ }
+
+private:
+ QQmlPrivate::AOTCompiledFunction m_aotFunction;
+};
+
}
QT_END_NAMESPACE