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):
-timestamp, ...
item1 3
item2 1
item5 8
-timestamp, ...
item1 1
item3 1
item5 5
-timestamp, ...
item1 3
item2 1
item5 8
-timestamp, ...
item1 1
item3 1
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
ITEM SUM
------------------
item1 4
item2 1
item3 1
item5 13
ITEM SUM
------------------
item1 4
item2 1
item3 1
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!
Bookmarks