summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-28 15:12:03 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-28 15:12:03 (GMT)
commit9149efe500f91c08867d3658ac1064c7f226841e (patch)
tree94b6c8dcec608aca4dd7be64487a8b2d0cdada57 /src/declarative/qml/qdeclarativeglobalscriptclass.cpp
parent4bd7a5df86f1292ad2acaa16a9e9c493c94a9c79 (diff)
parent2999c11b25b03d39f5abfe0f00607be6d536e3ce (diff)
downloadQt-9149efe500f91c08867d3658ac1064c7f226841e.zip
Qt-9149efe500f91c08867d3658ac1064c7f226841e.tar.gz
Qt-9149efe500f91c08867d3658ac1064c7f226841e.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: (44 commits) Stop QMLLauncher from crashing on exit on Mac when quitting app via the VisualDataModel hasModelChildren role shadowed user roles. Allow positioning of ListView items width sub-pixel precision. Examples clean up Docs Improve appearance when scaling Tweak Qt Demo Behaviour forget to rename the moc include when renaming deviceorientation_maemo.cpp fix namespace macros fix QML Viewer resize modes forgot to cleanup the code a bit after adding Maemo5 support Make the QML viewer usable on the N900 Test QTBUG-11222 Test ListElement type via type system, not string comparison. Test only on X11, not only on Linux (which includes embedded). Handle enums in method arguments in the same way as QtScript Allow custom parsers to handle attached properties Allow components to be created from .pragma library JS files Fix assert Disallow global object properties as property names ...
Diffstat (limited to 'src/declarative/qml/qdeclarativeglobalscriptclass.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
index 39ea101..d43443d 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 <QtCore/qvector.h>
#include <QtScript/qscriptstring.h>
#include <QtScript/qscriptengine.h>
@@ -57,6 +58,7 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi
: QScriptClass(engine)
{
QString eval = QLatin1String("eval");
+ QString version = QLatin1String("version");
QScriptValue originalGlobalObject = engine->globalObject();
@@ -72,6 +74,9 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi
QString name = iter.name();
+ if (name == version)
+ continue;
+
if (name != eval) {
names.append(name);
values.append(iter.value());
@@ -98,18 +103,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,
@@ -125,8 +119,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();
@@ -137,7 +132,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);