diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 706cae93c0..cd8bab90b2 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -2649,6 +2649,13 @@ bool ExecutionEngine::metaTypeFromJS(const Value &value, QMetaType metaType, voi } } + if (metaType == QMetaType::fromType>()) { + if (const QV4::QmlListWrapper *wrapper = value.as()) { + *reinterpret_cast *>(data) = wrapper->d()->property(); + return true; + } + } + if (const QQmlValueTypeWrapper *vtw = value.as()) { const QMetaType valueType = vtw->type(); if (valueType == metaType) diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index c7ed1cf4ef..f08a3dbcaf 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef Q_CC_MSVC #define NO_INLINE __declspec(noinline) @@ -1703,6 +1704,13 @@ void tst_QJSEngine::valueConversion_basic() QCOMPARE(eng.fromScriptValue(eng.toScriptValue(c)), c); } + { + QList list = {this}; + QQmlListProperty prop(this, &list); + QJSValue jsVal = eng.toScriptValue(prop); + QCOMPARE(eng.fromScriptValue>(jsVal), prop); + } + QVERIFY(eng.toScriptValue(static_cast(nullptr)).isNull()); }