From 595340f1622783e97c53b035b78691572537f00a Mon Sep 17 00:00:00 2001 From: Sebastian Sauer Date: Tue, 12 Aug 2014 18:52:50 +0700 Subject: 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 --- src/qml/qml/qqmlscriptstring.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlscriptstring.h b/src/qml/qml/qqmlscriptstring.h index 2c10df6efc..d85df0e867 100644 --- a/src/qml/qml/qqmlscriptstring.h +++ b/src/qml/qml/qqmlscriptstring.h @@ -54,6 +54,9 @@ class QObject; class QQmlContext; class QQmlScriptStringPrivate; class QQmlObjectCreator; +namespace QV4 { + struct QObjectWrapper; +} class Q_QML_EXPORT QQmlScriptString { public: @@ -79,6 +82,7 @@ private: friend class QQmlScriptStringPrivate; friend class QQmlExpression; friend class QQmlBinding; + friend struct QV4::QObjectWrapper; }; QT_END_NAMESPACE -- cgit v1.2.3