diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-08-26 03:17:51 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-08-26 03:17:51 (GMT) |
commit | cf58dcd5c5389e559316f99db825f786dbcc8ebe (patch) | |
tree | 32a7d0c3137a766041e4c9621af1e2d275b48029 /src | |
parent | b848c25000a3496dd1a3c4ffeb04786775cd4b50 (diff) | |
download | Qt-cf58dcd5c5389e559316f99db825f786dbcc8ebe.zip Qt-cf58dcd5c5389e559316f99db825f786dbcc8ebe.tar.gz Qt-cf58dcd5c5389e559316f99db825f786dbcc8ebe.tar.bz2 |
Some script engine cleanup.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 7923eda..ea00d65 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -266,9 +266,7 @@ QScriptValue QmlEnginePrivate::propertyObject(const QScriptString &propName, if (varobj) { return scriptEngine.newObject(objectClass, scriptEngine.newVariant(QVariant::fromValue(varobj))); } else { - if (var.type() == QVariant::Bool) - return QScriptValue(&scriptEngine, var.toBool()); - return scriptEngine.newVariant(var); + return qScriptValueFromValue(&scriptEngine, var); } } @@ -863,21 +861,14 @@ void QmlContextScriptClass::setProperty(QScriptValue &object, QmlContext *bindContext = static_cast<QmlContext*>(object.data().toQObject()); - int objIdx = (id & QmlScriptClass::ClassIdSelectorMask) >> 24; QObject *obj = bindContext->d_func()->defaultObjects.at(objIdx); - QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - QScriptValue oldact = scriptEngine->currentContext()->activationObject(); - scriptEngine->currentContext()->setActivationObject(scriptEngine->globalObject()); - QmlMetaProperty prop; prop.restore(id, obj); QVariant v = QmlScriptClass::toVariant(engine, value); prop.write(v); - - scriptEngine->currentContext()->setActivationObject(oldact); } ///////////////////////////////////////////////////////////// @@ -1058,17 +1049,11 @@ void QmlObjectScriptClass::setProperty(QScriptValue &object, QObject *obj = object.data().toQObject(); - QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - QScriptValue oldact = scriptEngine->currentContext()->activationObject(); - scriptEngine->currentContext()->setActivationObject(scriptEngine->globalObject()); - QmlMetaProperty prop; prop.restore(id, obj); QVariant v = QmlScriptClass::toVariant(engine, value); prop.write(v); - - scriptEngine->currentContext()->setActivationObject(oldact); } |