diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-21 16:05:53 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-06-21 16:11:33 +0200 |
commit | 4fc0a4fa75c57c3d345e97931e46aca628d6cedb (patch) | |
tree | 9042279f61629588126f9532c466bd2cc7c97843 /src | |
parent | 68d25720f0da3d4c5778c82d679ea53ec745e1dc (diff) |
Fix enumerating QObject properties
Make sure to enumerate the properties as well as the invokable methods.
Fixes various tests in qmltest
Change-Id: If40dbc8f2203f99d75523e40f78849224e301481
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/v4/qv4qobjectwrapper.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/qml/qml/v4/qv4qobjectwrapper.cpp b/src/qml/qml/v4/qv4qobjectwrapper.cpp index 087458dd68..67f2e07b02 100644 --- a/src/qml/qml/v4/qv4qobjectwrapper.cpp +++ b/src/qml/qml/v4/qv4qobjectwrapper.cpp @@ -650,7 +650,8 @@ Property *QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String return QV4::Object::advanceIterator(m, it, name, index, attributes); const QMetaObject *mo = that->m_object->metaObject(); - if (it->arrayIndex < mo->propertyCount()) { + const int propertyCount = mo->propertyCount(); + if (it->arrayIndex < propertyCount) { *name = that->engine()->newString(QString::fromUtf8(mo->property(it->arrayIndex).name())); ++it->arrayIndex; if (attributes) @@ -658,6 +659,15 @@ Property *QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String it->tmpDynamicProperty.value = that->get(*name); return &it->tmpDynamicProperty; } + const int methodCount = mo->methodCount(); + if (it->arrayIndex < propertyCount + methodCount) { + *name = that->engine()->newString(QString::fromUtf8(mo->method(it->arrayIndex - propertyCount).name())); + ++it->arrayIndex; + if (attributes) + *attributes = QV4::Attr_Data; + it->tmpDynamicProperty.value = that->get(*name); + return &it->tmpDynamicProperty; + } return QV4::Object::advanceIterator(m, it, name, index, attributes); } |