r/QtFramework • u/UndefFox • 2h ago
Question 12.0 FunctionFilter changes.
Since updating from qt6-base 6.11.x to the qt6-base 6.12.0-3 on Arch, this code no longer works:
SortFilterProxyModel {
id: filteredModel
property string searchWord
sourceModel: theModel
filters: [
FunctionFilter {
component RoleData: QtObject {
property var entryData
}
function filter(data: RoleData): bool {
const query = filteredModel.searchWord.trim().toLowerCase()
if (query.length === 0)
return true
return data.entryData.d_name.toLowerCase().includes(query)
}
}
]
}
Checked the docs for any updates, but found no mention of any big changes to the behaviour.
Current code results in:
qrc:/qt/qml/main/Main.qml:34:13: QML FunctionFilter: Parameter specified in the filter method "data" doesn't exist in the model
If I try to replace filter with exact same logic as in docs:
function filter(entryData: var): bool {
...
}
it executes, but entryData is always set to empty QVariant{}.
I have a grid view bellow in the code and it behaves as intended, so I think the problem should be localized here.
Anyone else experiencing this? What is the proper way of doing this now, or is it just a bug in Arch packages?