The first time I actually understand what your problem is. Was it so hard to say this?
Your are very correct. This forum contains no users who write Qt code or do model/view programming. We are all stupid. (If you don't get sarcasm, this was it)I don't expect help from this forum because I don't think there's anyone who has actually subclassed the model and written a custom sort that works.
I agree that some parts of the Qt item views isn't like I want it to be.I don't think Qt designed the item views well enough to actually do that.
How can anyone know what you mean if you don't say what you mean?If anyone out there has tried this, then they would know what I've been trying to do with it for a year and would maybe have some idea how to work around the Qt internals to get a sort and filter on an item view without using QSortFilterProxy.
And yes, there's a way to sort your data without a proxy model: sort your data inside the model!
Can you at least, I know it is hard to provide information, give a basic view of your data structure and how and what you want to sort?Thank you. That's a start. So let's say you override the data() and index() functions and of course sort(). The problem for me is the filtering. Nothing I've tried seems to filter it correctly. The last thing I tried a few weeks ago was using setRowHidden on a subclass of the QTreeView. But this seems to randomly lose the filtering. Is this something your familiar with?
Basically, your model contains the data structure. You can, when you add data for example, sort everything directly in the model. That would, as I think you suggest, make reading the data a lot faster because it doesn't need to be sorted when read. However, adding data can become slower of course. It also will break sorting in multiple views. Suppose you have a two listviews with the same model, you will not be able to sort them differently if you do it in the model directly, that's why proxy models are used.
Bookmarks