diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-01-20 04:01:26 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-01-20 04:01:26 (GMT) |
commit | 63fe6b6d3ff66067b8309c6111c49c6a41620e55 (patch) | |
tree | fe296fea28c0604eb07a2bc81248973c656a08b6 /src/declarative | |
parent | 3700ecf4236233fe73afbde671cfdc8e194a0125 (diff) | |
parent | f95956a6cc61d0c05d96e2f8027167f51ed7dbea (diff) | |
download | Qt-63fe6b6d3ff66067b8309c6111c49c6a41620e55.zip Qt-63fe6b6d3ff66067b8309c6111c49c6a41620e55.tar.gz Qt-63fe6b6d3ff66067b8309c6111c49c6a41620e55.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qmllistmodel.cpp | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index cd4a120..de6ee2e 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -265,7 +265,6 @@ struct ModelNode QmlListModel *modelCache; ModelObject *objectCache; - bool isArray; }; QT_END_NAMESPACE @@ -281,7 +280,6 @@ void ModelNode::setObjectValue(const QScriptValue& valuemap) { ModelNode *value = new ModelNode; QScriptValue v = it.value(); if (v.isArray()) { - value->isArray = true; value->setListValue(v); } else { value->values << v.toVariant(); @@ -298,7 +296,6 @@ void ModelNode::setListValue(const QScriptValue& valuelist) { ModelNode *value = new ModelNode; QScriptValue v = it.value(); if (v.isArray()) { - value->isArray = true; value->setListValue(v); } else if (v.isObject()) { value->setObjectValue(v); @@ -370,29 +367,27 @@ QVariant QmlListModel::valueForNode(ModelNode *node) const { QObject *rv = 0; - if (node->isArray) { + if (!node->properties.isEmpty()) { + // Object + rv = node->object(this); + } else if (node->values.count() == 0) { + // Invalid + return QVariant(); + } else if (node->values.count() == 1) { + // Value + QVariant &var = node->values[0]; + ModelNode *valueNode = qvariant_cast<ModelNode *>(var); + if (valueNode) { + if (!valueNode->properties.isEmpty()) + rv = valueNode->object(this); + else + rv = valueNode->model(this); + } else { + return var; + } + } else if (node->values.count() > 1) { // List rv = node->model(this); - } else { - if (!node->properties.isEmpty()) { - // Object - rv = node->object(this); - } else if (node->values.count() == 0) { - // Invalid - return QVariant(); - } else if (node->values.count() == 1) { - // Value - QVariant &var = node->values[0]; - ModelNode *valueNode = qvariant_cast<ModelNode *>(var); - if (valueNode) { - if (!valueNode->properties.isEmpty()) - rv = valueNode->object(this); - else - rv = valueNode->model(this); - } else { - return var; - } - } } if (rv) @@ -938,7 +933,7 @@ static void dump(ModelNode *node, int ind) } ModelNode::ModelNode() -: modelCache(0), objectCache(0), isArray(false) +: modelCache(0), objectCache(0) { } |