I have a QSqlTableModelthat requires a change in structure to be viewed in a QTreeView. So I use a QSortFilterProxyModelaround it because I want to sort it as well. I therefore need to reimplement mapToSource(), mapFromSource(), etc. But when I do this, sort() doesn't do anything. I'm assuming because the underlying items in the model do not change using the default implementation. Whats the right way to go about this with the least headache?

do I need to reimplement sort() in the QSortFilterProxyModel? That seems to defeat the purpose of using QSortFilterProxyModel.

Should I use a QAbstractProxyModel to handle the difference in structure and wrap that in a QSortFilterProxyModel? That also seems unecessary to have three models for my dataset.

Or am I missing something more straightforward?