diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-05-11 17:37:07 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-24 05:52:32 +0200 |
commit | 4709f30b26042427b225dd164648e3f5907c9d33 (patch) | |
tree | 3edac8d14d3fb77406ef93aa2c34c42131109625 /src/qml/qml/qqmlvme.cpp | |
parent | 2542778d4837143a61dfcf143c32683acc8b998a (diff) |
Enable binding to properties of type QJSValue.
This allows javascript objects of all types to be bound to properties
declared in c++. Compared to a QVariant the primary benefit this offers
is a type which functions and objects with functions can be bound to.
Change-Id: Idb3313e7ff1d616ab12d44f616083c8296201f3a
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index b86e3beaae..1665342ffd 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -426,6 +426,11 @@ QObject *QQmlVME::run(QList<QQmlError> *errors, QML_STORE_VAR(StoreVarDouble, v8::Number::New(instr.value)); QML_STORE_VAR(StoreVarBool, v8::Boolean::New(instr.value)); + // Store a literal value in a QJSValue property. + QML_STORE_VALUE(StoreJSValueString, QJSValue, QJSValue(PRIMITIVES.at(instr.value))); + QML_STORE_VALUE(StoreJSValueInteger, QJSValue, QJSValue(instr.value)); + QML_STORE_VALUE(StoreJSValueDouble, QJSValue, QJSValue(instr.value)); + QML_STORE_VALUE(StoreJSValueBool, QJSValue, QJSValue(instr.value)); QML_BEGIN_INSTR(Init) // Ensure that the compiled data has been initialized |