diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-12-06 10:51:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-24 10:32:35 +0100 |
commit | 70004585f89f325f398c556d101bfa1833d87b53 (patch) | |
tree | 050bd5a01a2c2ce61f756b13860da93302d7f317 /src/qml | |
parent | 13e88fe2b9b1680cb161a249289c3ba998f08c0c (diff) |
Change C++ parameter type used for var parameters in QML declared signals
"signal someSignal(var foo)" mapped to foo being of type QVariant.
Unfortunately that is a "lossy" type and it cannot represent all JavaScript
values, including for example function closures (as reported in the JIRA bug).
Instead we should use QJSValue. It is an important behavioural change because
it affects the presumably rare case of somebody declaring a signal in QML with
such a parameter and connect to it from C++ (or trying to emit it) - in that
situation the code needs to be changed.
Task-number: QTBUG-35171
Change-Id: I4fb4a18b407e4ea6c28a3a297fc6f76edb76d734
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmlcompiler.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 2e208f2f3b..f07d4bb703 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -2882,7 +2882,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod Object::DynamicProperty::Type dtype; int metaType; } builtinTypes[] = { - { Object::DynamicProperty::Var, QMetaType::QVariant }, + { Object::DynamicProperty::Var, qMetaTypeId<QJSValue>() }, { Object::DynamicProperty::Variant, QMetaType::QVariant }, { Object::DynamicProperty::Int, QMetaType::Int }, { Object::DynamicProperty::Bool, QMetaType::Bool }, diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 3798129e8b..81862a1429 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -128,7 +128,7 @@ bool QQmlPropertyCacheCreator::create(const QV4::CompiledData::Object *obj, QQml QV4::CompiledData::Property::Type dtype; int metaType; } builtinTypes[] = { - { QV4::CompiledData::Property::Var, QMetaType::QVariant }, + { QV4::CompiledData::Property::Var, qMetaTypeId<QJSValue>() }, { QV4::CompiledData::Property::Variant, QMetaType::QVariant }, { QV4::CompiledData::Property::Int, QMetaType::Int }, { QV4::CompiledData::Property::Bool, QMetaType::Bool }, |