summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlobjectscriptclass.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-14 05:12:55 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-14 05:12:55 (GMT)
commit4922be635aeaf25343892a73b30ec0d99d467e37 (patch)
tree2fd2454402347a872e556442132c8b530182db39 /src/declarative/qml/qmlobjectscriptclass.cpp
parent339c91215f0bae4af44fe3124f41244541607a2b (diff)
downloadQt-4922be635aeaf25343892a73b30ec0d99d467e37.zip
Qt-4922be635aeaf25343892a73b30ec0d99d467e37.tar.gz
Qt-4922be635aeaf25343892a73b30ec0d99d467e37.tar.bz2
Support read-only iteration of list properties
Eventually this should be extended to support modifying list properties.
Diffstat (limited to 'src/declarative/qml/qmlobjectscriptclass.cpp')
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 80f2786..122db51 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -45,6 +45,7 @@
#include <private/qmlcontext_p.h>
#include <private/qmldeclarativedata_p.h>
#include <private/qmltypenamescriptclass_p.h>
+#include <private/qmllistscriptclass_p.h>
#include <QtDeclarative/qmlbinding.h>
#include <QtCore/qtimer.h>
@@ -64,8 +65,7 @@ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine)
: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(bindEngine)), lastData(0),
engine(bindEngine)
{
- engine = bindEngine;
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(bindEngine);
+ QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
m_destroy = scriptEngine->newFunction(destroy);
m_destroyId = createPersistentIdentifier(QLatin1String("destroy"));
@@ -214,7 +214,13 @@ QScriptValue QmlObjectScriptClass::property(QObject *obj, const Identifier &name
return enginePriv->valueTypeClass->newObject(obj, lastData->coreIndex, valueType);
}
- if (lastData->flags & QmlPropertyCache::Data::IsQObjectDerived) {
+ if (lastData->flags & QmlPropertyCache::Data::IsQList) {
+ return enginePriv->listClass->newList(obj, lastData->coreIndex,
+ QmlListScriptClass::QListPtr);
+ } else if (lastData->flags & QmlPropertyCache::Data::IsQmlList) {
+ return enginePriv->listClass->newList(obj, lastData->coreIndex,
+ QmlListScriptClass::QmlListPtr);
+ } if (lastData->flags & QmlPropertyCache::Data::IsQObjectDerived) {
QObject *rv = 0;
void *args[] = { &rv, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args);