Hi!

I was already searching the net a lot but couldn't find an answer to my actual problem. So I'll try here...

I have a simple data-structure, a two-dimensional List (here very reduced to keep it simple): A QList<event>, every event contains a timestamp and a QList<items>, every item just text + value

Now in the window a have 2 views, a QTreeView and a QTableView

I've set up a data model for the TreeView and the TreeView displays the data as a tree of depth 2 (works nice):
Qt Code:
  1. -timestamp, ...
  2. item1 3
  3. item2 1
  4. item5 8
  5.  
  6. -timestamp, ...
  7. item1 1
  8. item3 1
  9. item5 5
To copy to clipboard, switch view to plain text mode 

Now the TableView shall display summary calculations of the same data in the form
Qt Code:
  1. ITEM SUM
  2. ------------------
  3. item1 4
  4. item2 1
  5. item3 1
  6. item5 13
To copy to clipboard, switch view to plain text mode 

Now I wonder which approach would be the "right" one? Use a ProxyModel to "map" the TreeModel to the TableModel and do the summary calculations in the ProxyModel?
Or give the TableView a TableModel which "uses" the TreeModel's data?

Thanks for any answers!