v4: Enable primitive conversation to QQmlScriptString in javascript
authorSebastian Sauer <sebastian.sauer.ford@kdab.com>
Tue, 12 Aug 2014 11:52:50 +0000 (18:52 +0700)
committerSebastian Sauer <sebastian.sauer@kdab.com>
Fri, 22 Aug 2014 18:46:08 +0000 (20:46 +0200)
commit595340f1622783e97c53b035b78691572537f00a
treeb3c5d037fd6feaeb5cc63bf6c24545a83c861e4b
parent29efdf1981a60a796e611f3bc8763afdcb6c2497
v4: Enable primitive conversation to QQmlScriptString in javascript

This makes following QML-code proper working:

ParentChange {
  x: 0
  Component.onCompleted: x = 10
}

where x is a QQmlScriptString.

Before this patch an error-message would be thrown that the
bool/int/string/etc cannot be converted to a QQmlScriptString.

With the patch primitive types including null and undefined are
proper converted to a QQmlScriptString. The patch ignores (as
in not implements) function/binding assignment.

Unfortunately since commit aa25ad8d5f4 its not possible any
longer to instanciate QQmlScriptString what means there is
otherwise no (easy) way to inject a QQmlScriptString from
within Javascript.

Change-Id: I18aac6a6e9a57f3b7d0a2d66cdab2be6c3c153c5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/compiler/qv4compileddata.cpp
src/qml/compiler/qv4compileddata_p.h
src/qml/jsruntime/qv4qobjectwrapper.cpp
src/qml/qml/qqmlscriptstring.h
tests/auto/qml/qqmllanguage/data/scriptStringJs.qml [new file with mode: 0644]
tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp