Tree model - Proxy model that wrapped original model under a single parent node
i am trying to create a proxy model using a read-only model that will have all the item in the R/O model under a single tree parent node. What function do I need to overwrite to make this happened? Do I derived from QAbstractItemModel or QAbstractProxyModel?
Example:
Original model
* A
** x y
* B
* C
** x y
Proxy Model (what I want)
* Name-String
** A
*** x y
** B
** C
*** x y
Re: Tree model - Proxy model that wrapped original model under a single parent node
Quote:
i am trying to create a proxy model using a read-only model that will have all the item in the R/O model under a single tree parent node......Do I derived from QAbstractItemModel or QAbstractProxyModel?
As you want to implement proxy model you should derive from QAbstractProxyModel
Quote:
What function do I need to overwrite to make this happened?
Implement mapFromSource(), mapToSource(), columnCount(), rowCount(), index(), parent(), and data()