diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-03-24 15:36:37 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-03-25 21:25:28 +0100 |
commit | d009c0088bac6da4d775345a60e33fee22af22ce (patch) | |
tree | ce420925f16f6fea77f9b6ee5e47e81b86011e4c /src/qml/jsruntime/qv4sequenceobject.cpp | |
parent | 3ce1ee554b7c9cb9200a88071cb2d9e45dda90c0 (diff) |
QV4::Engine::toVariant: Use metatype instead of metatype id
This way, we can avoid the costly id to metatype lookup in case where we
actually need the full metatype.
Task-number: QTBUG-88766
Change-Id: Ibe29b323007f00d2f8d1807fb9b64f9a8f87e807
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 95ba210753..0523d740fb 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -253,7 +253,7 @@ public: qsizetype count = size(); const QMetaType valueMetaType = meta(d())->valueMetaType(); - const QVariant element = engine()->toVariant(value, valueMetaType.id(), false); + const QVariant element = engine()->toVariant(value, valueMetaType, false); if (index == count) { append(element); @@ -680,7 +680,7 @@ QVariant SequencePrototype::toVariant(const QV4::Value &array, int typeHint, boo QV4::ScopedValue v(scope); for (quint32 i = 0; i < length; ++i) { const QMetaType valueMetaType = meta->valueMetaType(); - QVariant variant = scope.engine->toVariant(a->get(i), valueMetaType.id(), false); + QVariant variant = scope.engine->toVariant(a->get(i), valueMetaType, false); if (variant.metaType() != valueMetaType && !variant.convert(valueMetaType)) variant = QVariant(valueMetaType); meta->addValueAtEnd(result.data(), variant.constData()); |