diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-15 04:26:53 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-15 04:26:53 (GMT) |
commit | 4a665ff5da05860f5eb46e3982ef3d8163a6cf59 (patch) | |
tree | 7fb5275153bf7c639cce6f468e28d5f8c96fa679 /src/declarative/qml/qmlglobalscriptclass.cpp | |
parent | c5be2898cac41cf18ab14c3ee42d4d8c879c3e55 (diff) | |
download | Qt-4a665ff5da05860f5eb46e3982ef3d8163a6cf59.zip Qt-4a665ff5da05860f5eb46e3982ef3d8163a6cf59.tar.gz Qt-4a665ff5da05860f5eb46e3982ef3d8163a6cf59.tar.bz2 |
Implement custom QML slot invokation logic
Previously QML was inefficiently forwarding the task of invoking
Qt slots to QScript. QML does not implement the more advanced
argument coercian of QScript and does not support method overloading.
These two features are only needed to support legacy C++ classes
(of which QML has none), and are not worth the perf cost to support.
Diffstat (limited to 'src/declarative/qml/qmlglobalscriptclass.cpp')
-rw-r--r-- | src/declarative/qml/qmlglobalscriptclass.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlglobalscriptclass.cpp b/src/declarative/qml/qmlglobalscriptclass.cpp index 5387e03..13c1017 100644 --- a/src/declarative/qml/qmlglobalscriptclass.cpp +++ b/src/declarative/qml/qmlglobalscriptclass.cpp @@ -101,5 +101,21 @@ void QmlGlobalScriptClass::setProperty(QScriptValue &object, engine()->currentContext()->throwError(error); } +void QmlGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value) +{ + QScriptValue v = engine()->newObject(); + globalObject = engine()->globalObject(); + + QScriptValueIterator iter(globalObject); + while (iter.hasNext()) { + iter.next(); + v.setProperty(iter.scriptName(), iter.value()); + } + + v.setProperty(name, value); + v.setScriptClass(this); + engine()->setGlobalObject(v); +} + QT_END_NAMESPACE |