Skip to content

Adjust the role api

Marco Martin requested to merge work/mart/roleApi into master

Part of https://invent.kde.org/frameworks/plasma-framework/-/issues/19.

This is not a fully source compatible change, though makes the filter and sort roles api much cleaner. right now it shadows a QAbstractItemModel filerRole property changing ffrom int to QVariant, trying to guess between a role nameand a role number.

The rowFilterCallback instead always expects we know the role number as is sup[posed to use the QModelIndex data() function to fetch the vaue and do the decision whether filter the row or not. but in many existing users, the enum of additional roles we want to filter on is not exposed and even if we used role names, we need to fetch this mapping. this is the reason in Plasma still many PlasmaCore.SortFilterModel usages are there and we can't port them to this.

Edited by Nate Graham

Merge request reports