diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-23 03:27:09 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-23 03:27:09 (GMT) |
commit | 30b56f103e9fa868a4c3aa051555fd333626ee0a (patch) | |
tree | 88abdf2f947a60d22f75625b8ffcf69820562369 /src | |
parent | 25da7da1b5b454eae0b8080a97fd4a37d688aa54 (diff) | |
parent | 3e209785c3f027973089ccbebc6528501f416f2b (diff) | |
download | Qt-30b56f103e9fa868a4c3aa051555fd333626ee0a.zip Qt-30b56f103e9fa868a4c3aa051555fd333626ee0a.tar.gz Qt-30b56f103e9fa868a4c3aa051555fd333626ee0a.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
References to undefined variables throws a ReferenceError
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativeglobalscriptclass.cpp | 24 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeglobalscriptclass_p.h | 5 |
2 files changed, 11 insertions, 18 deletions
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp index 6e107fb..f29b3f4 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp @@ -41,6 +41,7 @@ #include "private/qdeclarativeglobalscriptclass_p.h" +#include <QtCore/qstringlist.h> #include <QtScript/qscriptstring.h> #include <QtScript/qscriptengine.h> #include <QtScript/qscriptvalueiterator.h> @@ -87,18 +88,7 @@ QDeclarativeGlobalScriptClass::queryProperty(const QScriptValue &object, Q_UNUSED(name); Q_UNUSED(flags); Q_UNUSED(id); - return HandlesReadAccess | HandlesWriteAccess; -} - -QScriptValue -QDeclarativeGlobalScriptClass::property(const QScriptValue &object, - const QScriptString &name, - uint id) -{ - Q_UNUSED(object); - Q_UNUSED(name); - Q_UNUSED(id); - return engine()->undefinedValue(); + return HandlesWriteAccess; } void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object, @@ -114,8 +104,9 @@ void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object, } /* This method is for the use of tst_qdeclarativeecmascript::callQtInvokables() only */ -void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value) +void QDeclarativeGlobalScriptClass::explicitSetProperty(const QStringList &names, const QList<QScriptValue> &values) { + Q_ASSERT(names.count() == values.count()); QScriptValue globalObject = engine()->globalObject(); QScriptValue v = engine()->newObject(); @@ -126,7 +117,12 @@ void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, con v.setProperty(iter.scriptName(), iter.value()); } - v.setProperty(name, value); + for (int ii = 0; ii < names.count(); ++ii) { + const QString &name = names.at(ii); + const QScriptValue &value = values.at(ii); + v.setProperty(name, value); + } + v.setScriptClass(this); engine()->setGlobalObject(v); diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h index 7690edd..fb44e5d 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h @@ -67,13 +67,10 @@ public: const QScriptString &name, QueryFlags flags, uint *id); - virtual QScriptValue property(const QScriptValue &object, - const QScriptString &name, uint id); - virtual void setProperty(QScriptValue &object, const QScriptString &name, uint id, const QScriptValue &value); - void explicitSetProperty(const QString &, const QScriptValue &); + void explicitSetProperty(const QStringList &, const QList<QScriptValue> &); const QScriptValue &globalObject() const { return m_globalObject; } |