QTableView + List with same model
-
wrote on 11 Apr 2014, 13:54 last edited by
Hi,
I'm developing a Qt Gui application. I want to use a listview side by side a tableview. I will list title's of my data in the listview, when user clicks on an item, its child items will be shown on a tableview.
For example i have 3 parent items with its childs as follows.
- Example Title 1
- 1 name1 age1 year1 email1
- 2 name2 age2 year2 email2
- 3 name3 age3 year3 email3 - Example Title 2
- 4 name4 age4 year4 email4
- 5 name5 age5 year5 email5
- 6 name6 age6 year6 email6 - Example Title 3
- 7 name7 age7 year7 email7
- 8 name8 age8 year8 email8
- 9 name9 age9 year9 email9
Listview will list ony Example Title 1 ,2 and 3. When user click on Example Title 1, Qtableview will be filled with its childs ( name1 age1 year1 email1 , name2 age2 year2 email2, name3 age3 year3 email3) with proper column names.
I can do this by using 2 seperate listmodel and tablemodel, but i need to combine them. Is there any better solution to my problem? I don't have to use listview it can be a widget too.
!http://oi62.tinypic.com/2zoad1l.jpg(thanks to my extraordinary paint skills)!
thanks.
- Example Title 1
1/1