diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-09-20 00:45:13 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-09-20 00:45:41 (GMT) |
commit | 68281ec913e2a69682f00bf22c291b15ea4ce542 (patch) | |
tree | aa18b7fcd88f06b4152568a0b8f662764d169b82 | |
parent | c8e4f99a7616120b180745674f652933731fd524 (diff) | |
download | Qt-68281ec913e2a69682f00bf22c291b15ea4ce542.zip Qt-68281ec913e2a69682f00bf22c291b15ea4ce542.tar.gz Qt-68281ec913e2a69682f00bf22c291b15ea4ce542.tar.bz2 |
Make build on Symbian
-rw-r--r-- | src/declarative/util/qdeclarativelistmodel.cpp | 31 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativelistmodel_p_p.h | 31 |
2 files changed, 33 insertions, 29 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) diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h index acf4f3e..d2d40ee 100644 --- a/src/declarative/util/qdeclarativelistmodel_p_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p_p.h @@ -255,35 +255,8 @@ struct ModelNode void clear(); - QDeclarativeListModel *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 *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; - } - + QDeclarativeListModel *model(const NestedListModel *model); + ModelObject *object(const NestedListModel *model); void setObjectValue(const QScriptValue& valuemap, bool writeToCache = true); void setListValue(const QScriptValue& valuelist); |