Maybe check this article about an identity proxy model by one of the kde guys. You might want to check that out and see if it gives you a nudge in the right direction.
Maybe check this article about an identity proxy model by one of the kde guys. You might want to check that out and see if it gives you a nudge in the right direction.
Horse sense is the thing that keeps horses from betting on people. --W.C. Fields
Ask Smart Questions
Thanks, Franz.
I spent some time last night going through the KDEUI lib and I found the KIdentityProxyModel and the KCategorizedSortFilterProxyModel, but unfortunately I don't see how they are going to help me yet. But they have given me some ideas.
I have an underlying CAbstractListModel with an attached QTableView. What I'd like to do is view the data from a list model in a QTreeView with arbitrary grouping defined by the user. The user should be able to specify a column (only one at a time, i.e. no nested grouping) to group by and then each unique value in that column would become a new parent node with the relevant original rows are children. Also the "group by" column would be hidden. I found an working online ASP.NET example of the kind of functionality I'm talking about here.
Maybe what I need to do is have a proxy model (inheriting from QSortFilterProxyModel perhaps) on top of the list model which provides extra functionality that is required by the QTreeView, e.g.
QModelIndex parent(const QModelIndex &index) const;
I want to create a generic solution because I have a few tables in my application that would benefit from this functionality. Unfortunately the priority of this job is not high at all so I'm not able to give it too much time right now. I'll post back with further ideas, progress, etc.
I did some more searching and found this wiki entry, [WIKI]Transpose_proxy_model[/WIKI].
I might just be getting closer to a possible answer. Having a specialised QAbstractProxyModel that is able to provide a QTreeView with the relevant hierarchical information could work. The trick is going to be working out the hierarchical details from a non-hierarchical model.
I'm going to have to just try it out and see what happens.
Bookmarks