diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-12-02 15:56:45 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-05 10:13:00 +0100 |
commit | 42ba473b3a1af1d6e0579dfc0ddb6c571c76d6c0 (patch) | |
tree | 046ced3d93e3e9b091e6bc1feeae9d1855df4cd1 /src | |
parent | 18d1e8c0482f70cd7b978169e7b8f7ab137bfc03 (diff) |
Fix QQuickVisualDataModel test failure.
When connecting the source object's notify signals to the proxy object's
the objectName property wasn't being skipped, this didn't matter much
before because the object name property didn't have a notify signal
and so was skipped anyway. Adding a notify signal resulted in all the
signal connections being off by one.
The object list proxy meta-object also shouldn't assume that QObject
has only and only ever will have one property.
Change-Id: I238e05153446cbfdceea643963e3a26f665e41a1
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickvisualadaptormodel.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/quick/items/qquickvisualadaptormodel.cpp b/src/quick/items/qquickvisualadaptormodel.cpp index 25baee6e29..6b7919c639 100644 --- a/src/quick/items/qquickvisualadaptormodel.cpp +++ b/src/quick/items/qquickvisualadaptormodel.cpp @@ -332,12 +332,13 @@ public: int metaCall(QMetaObject::Call call, int id, void **arguments) { + static const int objectPropertyOffset = QObject::staticMetaObject.propertyCount(); if (id >= m_type->propertyOffset && (call == QMetaObject::ReadProperty || call == QMetaObject::WriteProperty || call == QMetaObject::ResetProperty)) { if (m_object) - QMetaObject::metacall(m_object, call, id - m_type->propertyOffset + 1, arguments); + QMetaObject::metacall(m_object, call, id - m_type->propertyOffset + objectPropertyOffset, arguments); return -1; } else if (id >= m_type->signalOffset && call == QMetaObject::InvokeMetaMethod) { QMetaObject::activate(m_data, this, id, 0); @@ -352,13 +353,14 @@ public: if (!m_object) return -1; const QMetaObject *metaObject = m_object->metaObject(); + static const int objectPropertyOffset = QObject::staticMetaObject.propertyCount(); const int previousPropertyCount = propertyCount() - propertyOffset(); int propertyIndex = metaObject->indexOfProperty(name); if (propertyIndex == -1) return -1; - if (previousPropertyCount + 1 == metaObject->propertyCount()) - return propertyIndex + m_type->propertyOffset - 1; + if (previousPropertyCount + objectPropertyOffset == metaObject->propertyCount()) + return propertyIndex + m_type->propertyOffset - objectPropertyOffset; if (m_type->shared) { VDMDelegateDataType *type = m_type; @@ -368,8 +370,8 @@ public: const int previousMethodCount = methodCount(); int notifierId = previousMethodCount; - for (int propertyId = previousPropertyCount; propertyId < metaObject->propertyCount() - 1; ++propertyId) { - QMetaProperty property = metaObject->property(propertyId + 1); + for (int propertyId = previousPropertyCount; propertyId < metaObject->propertyCount() - objectPropertyOffset; ++propertyId) { + QMetaProperty property = metaObject->property(propertyId + objectPropertyOffset); QMetaPropertyBuilder propertyBuilder; if (property.hasNotifySignal()) { m_type->builder.addSignal("__" + QByteArray::number(propertyId) + "()"); @@ -389,15 +391,15 @@ public: *static_cast<QMetaObject *>(this) = *m_type->metaObject; notifierId = previousMethodCount; - for (int i = previousPropertyCount; i < metaObject->propertyCount(); ++i) { - QMetaProperty property = metaObject->property(i); + for (int i = previousPropertyCount; i < metaObject->propertyCount() - objectPropertyOffset; ++i) { + QMetaProperty property = metaObject->property(i + objectPropertyOffset); if (property.hasNotifySignal()) { QDeclarativePropertyPrivate::connect( m_object, property.notifySignalIndex(), m_data, notifierId); ++notifierId; } } - return propertyIndex + m_type->propertyOffset - 1; + return propertyIndex + m_type->propertyOffset - objectPropertyOffset; } QDeclarativeGuard<QObject> m_object; |