diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2016-06-21 13:16:41 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-06-21 12:17:59 +0000 |
commit | aa869cbb06bcf005e238059a2cb0205947ff0b5f (patch) | |
tree | a618ca8c951efce4fa9a91a1197011bc2881b038 /src | |
parent | 5d23470b8d0bacb0e0ba074672f94e526cc9e456 (diff) |
Add missing signal handling for QJSValue
Emitting signal with QJSValue argument ends
in QVariant converstion in qml bound signal
expression evaluation. Create missing handling
for arguments of type QJSValue.
Change-Id: I3d51a5455c09d0eef1123941066d20ad68f4074d
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 6d8f883e4c..a6fdf60c86 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -48,6 +48,7 @@ #include <private/qqmlcompiler_p.h> #include "qqmlinfo.h" +#include <private/qjsvalue_p.h> #include <private/qv4value_p.h> #include <QtCore/qstringbuilder.h> @@ -217,7 +218,9 @@ void QQmlBoundSignalExpression::evaluate(void **a) //### 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 == QMetaType::QVariant) { + if (type == qMetaTypeId<QJSValue>()) { + callData->args[ii] = *QJSValuePrivate::getValue(reinterpret_cast<QJSValue *>(a[ii + 1])); + } else if (type == QMetaType::QVariant) { callData->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 |