parent
4d96016151
commit
26501aa078
|
@ -55,6 +55,32 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: singleRowModel
|
||||
ListElement {
|
||||
changingRole: "Change me"
|
||||
otherRole: "I don't change"
|
||||
}
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: noProxyRolesProxyModel
|
||||
sourceModel: singleRowModel
|
||||
}
|
||||
|
||||
Instantiator {
|
||||
id: outerInstantiator
|
||||
model: noProxyRolesProxyModel
|
||||
QtObject {
|
||||
property var counter: ({ count : 0 })
|
||||
property string changingRole: model.changingRole
|
||||
property string otherRole: {
|
||||
++counter.count;
|
||||
return model.otherRole;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TestCase {
|
||||
name: "ProxyRoles"
|
||||
|
||||
|
@ -89,5 +115,12 @@ Item {
|
|||
compare(testModel.get(0, "role1"), "data for role1");
|
||||
compare(testModel.get(0, "role2"), "data for role2");
|
||||
}
|
||||
|
||||
function test_ProxyRolesDataChanged() {
|
||||
outerInstantiator.object.counter.count = 0;
|
||||
singleRowModel.setProperty(0, "changingRole", "Changed")
|
||||
compare(outerInstantiator.object.changingRole, "Changed");
|
||||
compare(outerInstantiator.object.counter.count, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue