diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-10-07 05:29:06 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-10-07 05:29:06 (GMT) |
commit | 0e91a2e5cb940f5f677345a2f811061b75b32635 (patch) | |
tree | 893accb41dddef51b075754be7a01debbc6cb311 /src | |
parent | afcad4b4393b4f7187737fb8b4e528887b07d943 (diff) | |
download | Qt-0e91a2e5cb940f5f677345a2f811061b75b32635.zip Qt-0e91a2e5cb940f5f677345a2f811061b75b32635.tar.gz Qt-0e91a2e5cb940f5f677345a2f811061b75b32635.tar.bz2 |
Compile on Symbian.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/util/qmllistmodel.cpp | 80 |
1 files changed, 44 insertions, 36 deletions
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 69bed25..062ab48 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -239,41 +239,8 @@ struct ModelNode return objectCache; } - void setListValue(const QScriptValue& valuelist) { - QScriptValueIterator it(valuelist); - values.clear(); - while (it.hasNext()) { - it.next(); - ModelNode *value = new ModelNode; - QScriptValue v = it.value(); - if (v.isArray()) { - value->setListValue(v); - } else if (v.isObject()) { - value->setObjectValue(v); - } else { - value->values << v.toVariant(); - } - values.append(qVariantFromValue(value)); - - } - } - - void setObjectValue(const QScriptValue& valuemap) { - QScriptValueIterator it(valuemap); - while (it.hasNext()) { - it.next(); - ModelNode *value = new ModelNode; - QScriptValue v = it.value(); - if (v.isArray()) { - value->setListValue(v); - } else if (v.isObject()) { - value->setObjectValue(v); - } else { - value->values << v.toVariant(); - } - properties.insert(it.name(),value); - } - } + void setObjectValue(const QScriptValue& valuemap); + void setListValue(const QScriptValue& valuelist); void setProperty(const QString& prop, const QVariant& val) { QHash<QString, ModelNode *>::const_iterator it = properties.find(prop); @@ -292,6 +259,48 @@ struct ModelNode ModelObject *objectCache; }; +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(ModelNode *) + +QT_BEGIN_NAMESPACE +void ModelNode::setObjectValue(const QScriptValue& valuemap) { + QScriptValueIterator it(valuemap); + while (it.hasNext()) { + it.next(); + ModelNode *value = new ModelNode; + QScriptValue v = it.value(); + if (v.isArray()) { + value->setListValue(v); + } else if (v.isObject()) { + value->setObjectValue(v); + } else { + value->values << v.toVariant(); + } + properties.insert(it.name(),value); + } +} + +void ModelNode::setListValue(const QScriptValue& valuelist) { + QScriptValueIterator it(valuelist); + values.clear(); + while (it.hasNext()) { + it.next(); + ModelNode *value = new ModelNode; + QScriptValue v = it.value(); + if (v.isArray()) { + value->setListValue(v); + } else if (v.isObject()) { + value->setObjectValue(v); + } else { + value->values << v.toVariant(); + } + values.append(qVariantFromValue(value)); + + } +} + + ModelObject::ModelObject() : _mo(new QmlOpenMetaObject(this)) { @@ -846,7 +855,6 @@ ModelNode::~ModelNode() QT_END_NAMESPACE -Q_DECLARE_METATYPE(ModelNode *) QML_DECLARE_TYPE(QmlListElement) #include "qmllistmodel.moc" |