diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-02-12 09:23:33 +0100 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-02-12 11:59:25 +0100 |
commit | 9c282fe2e90eec05e160241069c219c7f09f4078 (patch) | |
tree | 0ed75df8be9e4802dea5b3d5a451548cfa53f6e7 /src/qml/qml/qqmlboundsignal.cpp | |
parent | 4660f51f25a6c56182dff0ea24f7c1ad2bac9cea (diff) |
Transform JSCallData args setting into a function
Change-Id: I4154a0b5c7115375292794e0564d2f3657e6b4dd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 8fceb94f45..1bc0efc5d9 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -196,27 +196,7 @@ void QQmlBoundSignalExpression::evaluate(void **a) int argCount = argsTypes ? *argsTypes : 0; QV4::JSCallData jsCall(scope, argCount); - for (int ii = 0; ii < argCount; ++ii) { - int type = argsTypes[ii + 1]; - //### ideally we would use metaTypeToJS, however it currently gives different results - // for several cases (such as QVariant type and QObject-derived types) - //args[ii] = engine->metaTypeToJS(type, a[ii + 1]); - if (type == qMetaTypeId<QJSValue>()) { - jsCall->args[ii] = QJSValuePrivate::convertToReturnedValue(v4, *reinterpret_cast<QJSValue *>(a[ii + 1])); - } else if (type == QMetaType::QVariant) { - jsCall->args[ii] = scope.engine->fromVariant(*((QVariant *)a[ii + 1])); - } else if (type == QMetaType::Int) { - //### optimization. Can go away if we switch to metaTypeToJS, or be expanded otherwise - jsCall->args[ii] = QV4::Value::fromInt32(*reinterpret_cast<const int*>(a[ii + 1])); - } else if (ep->isQObject(type)) { - if (!*reinterpret_cast<void* const *>(a[ii + 1])) - jsCall->args[ii] = QV4::Value::nullValue(); - else - jsCall->args[ii] = QV4::QObjectWrapper::wrap(v4, *reinterpret_cast<QObject* const *>(a[ii + 1])); - } else { - jsCall->args[ii] = scope.engine->fromVariant(QVariant(QMetaType(type), a[ii + 1])); - } - } + populateJSCallArguments(ep, v4, jsCall, a, argsTypes); QQmlJavaScriptExpression::evaluate(jsCall.callData(), nullptr); |