tags:

views:

39

answers:

1

I have a neat Model based off QAbstractItemModel. This has a simple hierarchical tree structure which works perfectly for QTreeView. However, I want the QTableView/QListView to access and display only the leaf nodes( ALL leaf nodes ). What is the best way to do this? I don't want to rebuild the model( because it will be expensive ) and I do not want to have two models( same reason ).

+1  A: 

You could create a proxy model. A class that sits between the View and the Model and filters out all of the non-leaf nodes and then just forwards the function calls to the original model for the leaves.

Gianni