TreeModel from TableModel
I need to create a tree model with the following req's
- this tree model will have a flat table source (QAbstractTableModel)
- hierarchy will be based on the sort columns
- at the end of the day a QTreeView and this model will behave exactly like the new Outlook 2010 Inbox list , when the user click sort by date a tree will be presented grouped by date
I am thinking is a job for a QSortFilterProxyModel and a CustomTreeModel that will goup things according to QSortFilterProxyModel::sortColumn and convert it into a tree in the QTreeView points of View.
Is there any other good suggestions out there?
baray98
Re: TreeModel from TableModel
QSortFilterProxyModel will not work as it cannot move an item to a different parent. You need to implement your own subclass of QAbstractProxyModel.
Re: TreeModel from TableModel
CustomTreeModel will come handy which inherits QAbstractItemModel to wrap around the sortfilter model. The sort filter model will be used only for sorting and giving the sortColumn in which the grouping will be based upon..
-baray98-
Re: TreeModel from TableModel
It needs to be done the other way round. The sort filter proxy model needs to wrap the tree (proxy) model. Otherwise sorting will not take into consideration the parent-child relationship of items.