summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qdeclarativelistmodel.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-09-20 00:45:13 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-09-20 00:45:41 (GMT)
commit68281ec913e2a69682f00bf22c291b15ea4ce542 (patch)
treeaa18b7fcd88f06b4152568a0b8f662764d169b82 /src/declarative/util/qdeclarativelistmodel.cpp
parentc8e4f99a7616120b180745674f652933731fd524 (diff)
downloadQt-68281ec913e2a69682f00bf22c291b15ea4ce542.zip
Qt-68281ec913e2a69682f00bf22c291b15ea4ce542.tar.gz
Qt-68281ec913e2a69682f00bf22c291b15ea4ce542.tar.bz2
Make build on Symbian
Diffstat (limited to 'src/declarative/util/qdeclarativelistmodel.cpp')
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 2d8b946..3263238 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -356,6 +356,37 @@ void QDeclarativeListModel::clear()
}
}
+QDeclarativeListModel *ModelNode::model(const NestedListModel *model)
+{
+ if (!modelCache) {
+ modelCache = new QDeclarativeListModel;
+ QDeclarativeEngine::setContextForObject(modelCache,QDeclarativeEngine::contextForObject(model->m_listModel));
+ modelCache->m_nested->_root = this; // ListModel defaults to nestable model
+
+ for (int i=0; i<values.count(); ++i) {
+ ModelNode *subNode = qvariant_cast<ModelNode *>(values.at(i));
+ if (subNode)
+ subNode->m_model = modelCache->m_nested;
+ }
+ }
+ return modelCache;
+}
+
+ModelObject *ModelNode::object(const NestedListModel *model)
+{
+ if (!objectCache) {
+ objectCache = new ModelObject(this,
+ const_cast<NestedListModel*>(model),
+ QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(model->m_listModel)));
+ QHash<QString, ModelNode *>::iterator it;
+ for (it = properties.begin(); it != properties.end(); ++it) {
+ objectCache->setValue(it.key().toUtf8(), model->valueForNode(*it));
+ }
+ objectCache->setNodeUpdatesEnabled(true);
+ }
+ return objectCache;
+}
+
/*!
\qmlmethod ListModel::remove(int index)