I have the following SortFilterProxyModel with an ExpressionRole that has a name that changes based on some property binding. When I select option 'a' or 'b' I expect that I could use the respective role name, but it seems to not trigger the expression function (no log message) and I get undefined as a return value. Does the SortFilterProxyModel not support the behavior that I want or is QML not recognizing that there is a new role present?
ComboBox{
id: nameComboBox
model: ['a','b']
currentIndex: 0
}
SortFilterProxyModel{
id: minimumTestModel
sourceModel: ListModel{
ListElement{
unUsed: "you can ignore this"
}
}
proxyRoles: [
ExpressionRole{
// dynamic name, should work when 'b' is selected in ComboBox but doesnt
name: nameComboBox.currentValue
expression: {
console.log('trigger')
return 1
}
},
ExpressionRole{
// constant name - present in the combobox, works
name: 'a'
expression: {
console.log('trigger')
return 2
}
}
]
}
Repeater{
model: minimumTestModel
delegate: Text{
text: model[nameComboBox.currentValue]
}
}
I have the following SortFilterProxyModel with an ExpressionRole that has a name that changes based on some property binding. When I select option 'a' or 'b' I expect that I could use the respective role name, but it seems to not trigger the expression function (no log message) and I get
undefined
as a return value. Does the SortFilterProxyModel not support the behavior that I want or is QML not recognizing that there is a new role present?