aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-24 12:13:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 09:05:19 +0200
commita57085f00b146798a0cca0d52dfa127232c3e659 (patch)
tree7b4df3f155d431aeb6f3aae01943a3411c812a7b /src/qml/types/qqmllistmodel.cpp
parent12fd2ccd3fa2dc0133b5a3fb89f9fdf5cf721232 (diff)
Fix API of QQmlV4Handle
Change-Id: Iac4a3fefebd33a5990408598486231a5add8e639 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types/qqmllistmodel.cpp')
-rw-r--r--src/qml/types/qqmllistmodel.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 4ce5047c8f..7965bc046d 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -2142,7 +2142,8 @@ QQmlV4Handle QQmlListModel::get(int index) const
*/
void QQmlListModel::set(int index, const QQmlV4Handle &handle)
{
- QV4::Object *object = handle.toValue().asObject();
+ QV4::Scope scope(QV8Engine::getV4(engine()));
+ QV4::ScopedObject object(scope, handle);
if (!object) {
qmlInfo(this) << tr("set: value is not an object");
@@ -2157,9 +2158,9 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
if (index == count()) {
if (m_dynamicRoles) {
- m_modelObjects.append(DynamicRoleModelNode::create(engine()->variantMapFromJS(object), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(engine()->variantMapFromJS(object.getPointer()), this));
} else {
- m_listModel->insert(index, object, engine());
+ m_listModel->insert(index, object.getPointer(), engine());
}
emitItemsInserted(index, 1);
@@ -2168,9 +2169,9 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
QVector<int> roles;
if (m_dynamicRoles) {
- m_modelObjects[index]->updateValues(engine()->variantMapFromJS(object), roles);
+ m_modelObjects[index]->updateValues(engine()->variantMapFromJS(object.getPointer()), roles);
} else {
- m_listModel->set(index, object, &roles, engine());
+ m_listModel->set(index, object.getPointer(), &roles, engine());
}
if (roles.count())