aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qobjectwrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-02 16:54:59 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-02 20:25:55 +0000
commita88f01364e147d9ea093bf0fdc639b45feef1788 (patch)
treecf1c49dee57f1c691eeecd633bffd0601256f236 /src/qml/jsruntime/qv4qobjectwrapper.cpp
parent0d63c22eee293fe59d7691608deaaf3468045eb3 (diff)
Implement ObjectIterator using the new iteration mechanism
And with that get rid of the old advanceIterator methods. Change-Id: I969fa89d25df8992a4b08c8c081b91c92ffdfddd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper.cpp')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 61678acdad..23a268b8b9 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -760,60 +760,6 @@ PropertyAttributes QObjectWrapper::virtualGetOwnProperty(Managed *m, PropertyKey
return QV4::Object::virtualGetOwnProperty(m, id, p);
}
-void QObjectWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes)
-{
- // Used to block access to QObject::destroyed() and QObject::deleteLater() from QML
- static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
- static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()");
- static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()");
-
- name->setM(nullptr);
- *index = UINT_MAX;
-
- QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
-
- QObject *thatObject = that->d()->object();
- if (thatObject && !QQmlData::wasDeleted(thatObject)) {
- const QMetaObject *mo = thatObject->metaObject();
- // These indices don't apply to gadgets, so don't block them.
- const bool preventDestruction = mo->superClass() || mo == &QObject::staticMetaObject;
- const int propertyCount = mo->propertyCount();
- if (it->arrayIndex < static_cast<uint>(propertyCount)) {
- ExecutionEngine *thatEngine = that->engine();
- Scope scope(thatEngine);
- const QMetaProperty property = mo->property(it->arrayIndex);
- ScopedString propName(scope, thatEngine->newString(QString::fromUtf8(property.name())));
- name->setM(propName->d());
- ++it->arrayIndex;
- *attributes = QV4::Attr_Data;
-
- QQmlPropertyData local;
- local.load(property);
- p->value = that->getProperty(thatEngine, thatObject, &local);
- return;
- }
- const int methodCount = mo->methodCount();
- while (it->arrayIndex < static_cast<uint>(propertyCount + methodCount)) {
- const int index = it->arrayIndex - propertyCount;
- const QMetaMethod method = mo->method(index);
- ++it->arrayIndex;
- if (method.access() == QMetaMethod::Private || (preventDestruction && (index == deleteLaterIdx || index == destroyedIdx1 || index == destroyedIdx2)))
- continue;
- ExecutionEngine *thatEngine = that->engine();
- Scope scope(thatEngine);
- ScopedString methodName(scope, thatEngine->newString(QString::fromUtf8(method.name())));
- name->setM(methodName->d());
- *attributes = QV4::Attr_Data;
-
- QQmlPropertyData local;
- local.load(method);
- p->value = that->getProperty(thatEngine, thatObject, &local);
- return;
- }
- }
- QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes);
-}
-
struct QObjectWrapperOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
int propertyIndex = 0;