SortFilterProxyModel and modelData
-
How can I use StringSorter or RoleSorter with custom c++ models that are normally accessed by modelData?
ListView { anchors.fill: parent model: SortFilterProxyModel { model: myCustomModel sorters: StringSorter { roleName: "name" } } delegate: Text { required property var modelData text: modelData.name } } -
How can I use StringSorter or RoleSorter with custom c++ models that are normally accessed by modelData?
ListView { anchors.fill: parent model: SortFilterProxyModel { model: myCustomModel sorters: StringSorter { roleName: "name" } } delegate: Text { required property var modelData text: modelData.name } }@Ashley-Paul You can't, those work based on roles.
If your model is a list of QObject* I would suggest using https://github.com/OlivierLDff/ObjectListModel/ or QRangeModel as your model.
-
A Ashley Paul has marked this topic as solved