diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-18 04:35:49 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-18 04:36:33 (GMT) |
commit | 8bcae7dd3f9138030c6ac27868ca8574f03f4d31 (patch) | |
tree | c2c96b03106c2880d7598b8cd2cc96bd3cf32c62 | |
parent | 4731b836a4754d6f3a403db5be8b9d3bf6de1570 (diff) | |
download | Qt-8bcae7dd3f9138030c6ac27868ca8574f03f4d31.zip Qt-8bcae7dd3f9138030c6ac27868ca8574f03f4d31.tar.gz Qt-8bcae7dd3f9138030c6ac27868ca8574f03f4d31.tar.bz2 |
Don't use QScriptValueIterator to iterate over arrays.
-rw-r--r-- | src/declarative/util/qdeclarativelistmodel.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 5b0a7ea..340e9ac 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -1286,10 +1286,10 @@ void ModelNode::setObjectValue(const QScriptValue& valuemap) { void ModelNode::setListValue(const QScriptValue& valuelist) { QScriptValueIterator it(valuelist); values.clear(); - while (it.hasNext()) { - it.next(); + int size = valuelist.property(QLatin1String("length")).toInt32(); + for (int i=0; i<size; i++) { ModelNode *value = new ModelNode; - QScriptValue v = it.value(); + QScriptValue v = valuelist.property(i); if (v.isArray()) { value->isArray = true; value->setListValue(v); @@ -1299,7 +1299,6 @@ void ModelNode::setListValue(const QScriptValue& valuelist) { value->values << v.toVariant(); } values.append(qVariantFromValue(value)); - } } |