Pass the right signal index in visualadaptormodel proxy meta-object
For QMetaObject::activate(), the index must be relative to the class's own signals (excluding non-signal methods). For QMetaObjectBuilder, the notifier index must be relative to the class's own methods. Change-Id: I22f55d1fc55d56c997135dc78f51b710b37bb01a Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
This commit is contained in:
parent
836bade876
commit
15fd9d0c23
|
@ -882,7 +882,7 @@ public:
|
||||||
QMetaObject::metacall(m_data->object, call, id - m_type->propertyOffset + objectPropertyOffset, arguments);
|
QMetaObject::metacall(m_data->object, call, id - m_type->propertyOffset + objectPropertyOffset, arguments);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (id >= m_type->signalOffset && call == QMetaObject::InvokeMetaMethod) {
|
} else if (id >= m_type->signalOffset && call == QMetaObject::InvokeMetaMethod) {
|
||||||
QMetaObject::activate(m_data, this, id, 0);
|
QMetaObject::activate(m_data, this, id - m_type->signalOffset, 0);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return m_data->qt_metacall(call, id, arguments);
|
return m_data->qt_metacall(call, id, arguments);
|
||||||
|
@ -910,7 +910,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const int previousMethodCount = methodCount();
|
const int previousMethodCount = methodCount();
|
||||||
int notifierId = previousMethodCount;
|
int notifierId = previousMethodCount - methodOffset();
|
||||||
for (int propertyId = previousPropertyCount; propertyId < metaObject->propertyCount() - objectPropertyOffset; ++propertyId) {
|
for (int propertyId = previousPropertyCount; propertyId < metaObject->propertyCount() - objectPropertyOffset; ++propertyId) {
|
||||||
QMetaProperty property = metaObject->property(propertyId + objectPropertyOffset);
|
QMetaProperty property = metaObject->property(propertyId + objectPropertyOffset);
|
||||||
QMetaPropertyBuilder propertyBuilder;
|
QMetaPropertyBuilder propertyBuilder;
|
||||||
|
|
|
@ -10,7 +10,7 @@ ListView {
|
||||||
height: 25
|
height: 25
|
||||||
width: 100
|
width: 100
|
||||||
color: model.modelData.color
|
color: model.modelData.color
|
||||||
Text { objectName: "name"; text: name; function getText() { return name } }
|
Text { objectName: "name"; text: name; property string modelName: model.name; function getText() { return name } }
|
||||||
Text { objectName: "section"; text: parent.ListView.section }
|
Text { objectName: "section"; text: parent.ListView.section }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,12 +525,14 @@ void tst_qquickvisualdatamodel::objectListModel()
|
||||||
|
|
||||||
QQuickText *name = findItem<QQuickText>(contentItem, "name", 0);
|
QQuickText *name = findItem<QQuickText>(contentItem, "name", 0);
|
||||||
QCOMPARE(name->text(), QString("Item 1"));
|
QCOMPARE(name->text(), QString("Item 1"));
|
||||||
|
QCOMPARE(name->property("modelName").toString(), QString("Item 1"));
|
||||||
|
|
||||||
QQuickText *section = findItem<QQuickText>(contentItem, "section", 0);
|
QQuickText *section = findItem<QQuickText>(contentItem, "section", 0);
|
||||||
QCOMPARE(section->text(), QString("Item 1"));
|
QCOMPARE(section->text(), QString("Item 1"));
|
||||||
|
|
||||||
dataList[0]->setProperty("name", QLatin1String("Changed"));
|
dataList[0]->setProperty("name", QLatin1String("Changed"));
|
||||||
QCOMPARE(name->text(), QString("Changed"));
|
QCOMPARE(name->text(), QString("Changed"));
|
||||||
|
QCOMPARE(name->property("modelName").toString(), QString("Changed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_qquickvisualdatamodel::singleRole()
|
void tst_qquickvisualdatamodel::singleRole()
|
||||||
|
|
Loading…
Reference in New Issue