From a88f01364e147d9ea093bf0fdc639b45feef1788 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 2 Aug 2018 16:54:59 +0200 Subject: Implement ObjectIterator using the new iteration mechanism And with that get rid of the old advanceIterator methods. Change-Id: I969fa89d25df8992a4b08c8c081b91c92ffdfddd Reviewed-by: Simon Hausmann --- src/qml/types/qqmllistmodel.cpp | 23 ----------------------- src/qml/types/qqmllistmodel_p_p.h | 1 - 2 files changed, 24 deletions(-) (limited to 'src/qml/types') diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 30e5b83d5c..8d1ea6f828 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1610,29 +1610,6 @@ ReturnedValue ModelObject::virtualGet(const Managed *m, PropertyKey id, const Va return that->engine()->fromVariant(value); } -void ModelObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) -{ - ModelObject *that = static_cast(m); - ExecutionEngine *v4 = that->engine(); - name->setM(nullptr); - *index = UINT_MAX; - if (it->arrayIndex < uint(that->d()->m_model->m_listModel->roleCount())) { - Scope scope(that->engine()); - const ListLayout::Role &role = that->d()->m_model->m_listModel->getExistingRole(it->arrayIndex); - ++it->arrayIndex; - ScopedString roleName(scope, v4->newString(role.name)); - name->setM(roleName->d()); - *attributes = QV4::Attr_Data; - QVariant value = that->d()->m_model->data(that->d()->elementIndex(), role.index); - p->value = v4->fromVariant(value); - return; - } - // Fall back to QV4::Object as opposed to QV4::QObjectWrapper otherwise it will add - // unnecessary entries that relate to the roles used. These just create extra work - // later on as they will just be ignored. - QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes); -} - struct ModelObjectOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator { int roleNameIndex = 0; diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index dbd0b0a2a2..46a41ac8c8 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -181,7 +181,6 @@ struct ModelObject : public QObjectWrapper protected: static bool virtualPut(Managed *m, PropertyKey id, const Value& value, Value *receiver); static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m); }; -- cgit v1.2.3