aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-03-11 11:07:58 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-03-13 10:08:48 +0100
commiteb2386a04260966c5d1f13941f7a10154e11625a (patch)
tree2bbe824419230c62de6d88f255f45819c757a62b /src/qml/jsruntime/qv4engine_p.h
parenta9c93e2716a097c637515aded49a3308e257204b (diff)
Optimize ExecutionEngine::metaTypeToJS()
We almost never need to construct a QVariant to do this. Constructing a QVariant is excessively expensive if you have something simple like an integer. This also fixes the unexpected "unwrapping" of variants when we pass them through QJSValue. [ChangeLog][QtQml][Important Behavior Changes] If you create a QJSValue from a nested QVariant (that is, a QVariant containing another QVariant), then, when retrieving its contents again, the outer variant is not unwrapped anymore. Rather, you get exactly the value you've passed in. Change-Id: I8c16eed4f13e8cfdeced0756eef593b3b8e84dd1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine_p.h')
-rw-r--r--src/qml/jsruntime/qv4engine_p.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 6c3d2d4436..0edac38d9c 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -747,6 +747,9 @@ public:
QQmlRefPointer<QQmlContextData> ctxtdata, int argc, void **args, QMetaType *types);
private:
+ QV4::ReturnedValue fromData(
+ const QMetaType &type, const void *ptr, const QVariant *variant = nullptr);
+
#if QT_CONFIG(qml_debug)
QScopedPointer<QV4::Debugging::Debugger> m_debugger;
QScopedPointer<QV4::Profiling::Profiler> m_profiler;