diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-09 01:58:49 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-10 03:45:26 (GMT) |
commit | f155b637f1f4f6181f893e4debef2adb64312ca8 (patch) | |
tree | ff185f515edca62bbf5fb877e6b0f7756ef51674 /src/script/api/qscriptvalue.cpp | |
parent | 283491506c1a13f43206ccdf0fe542594dd130e8 (diff) | |
download | Qt-f155b637f1f4f6181f893e4debef2adb64312ca8.zip Qt-f155b637f1f4f6181f893e4debef2adb64312ca8.tar.gz Qt-f155b637f1f4f6181f893e4debef2adb64312ca8.tar.bz2 |
Add QScriptDeclarativeClass
QScriptDeclarativeClass is a private, but exported, class used by the
declarativeui module. It is very similar to QScriptClass, but slightly
faster and provides a couple of "backdoor" extension mechanisms used
by declarative.
Reviewed-by: Warwick Allison
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 52a1e6d..d6cbb41 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -71,6 +71,7 @@ #include "bridge/qscriptclassobject_p.h" #include "bridge/qscriptvariant_p.h" #include "bridge/qscriptqobject_p.h" +#include "bridge/qscriptdeclarativeclass_p.h" /*! \since 4.3 @@ -1496,6 +1497,8 @@ QVariant QScriptValue::toVariant() const #endif else if (isArray()) return QScriptEnginePrivate::variantListFromArray(*this); + else if (QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(*this)) + return dc->toVariant(QScriptDeclarativeClass::object(*this)); // try to convert to primitive JSC::ExecState *exec = d->engine->currentFrame; JSC::JSValue savedException; @@ -1586,6 +1589,8 @@ QObject *QScriptValue::toQObject() const if (isQObject()) { QScriptObject *object = static_cast<QScriptObject*>(JSC::asObject(d->jscValue)); return static_cast<QScript::QObjectDelegate*>(object->delegate())->value(); + } else if (QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(*this)) { + return dc->toQObject(QScriptDeclarativeClass::object(*this)); } else if (isVariant()) { QVariant var = toVariant(); int type = var.userType(); |