Xaleandr
28th December 2007, 19:16
Hello everybody,
I have a problem how to merge a QTableView and QTreeView.
Originally, I have an SQL table of type:
-------------------------------------------------
| Name | Surname | Profession | Age
-------------------------------------------------
| John | Smith | Engineer | 25
| Mike | Parrot | Designer | 35
| Alex | Funny | Engineer | 45
| Alex | Fellow | Designer | 29
| Alice | Young | Secretary | 20
--------------------------------------------------
The simplest way to represent data is to use QSqlTableModel and get a single table.
My question is, if it is possible to merge QTableView and QTreeView and represent result as a tree of tables, based by one of the fields, e.g. by "Profession":
+---Engineer:
| -------------------------------------------------
| | John | Smith | engineer | 25
| | Alex | Funny | engineer | 45
| -------------------------------------------------
|
+---Designer:
| -------------------------------------------------
| | Mike | Parrot | designer | 35
| | Alex | Fellow | designer | 29
| -------------------------------------------------
|
+---Secretary:
-------------------------------------------------
| Alice | Young | Secretary | 20
-------------------------------------------------
Thanks in advance for possible hints,
Xaleandr
I have a problem how to merge a QTableView and QTreeView.
Originally, I have an SQL table of type:
-------------------------------------------------
| Name | Surname | Profession | Age
-------------------------------------------------
| John | Smith | Engineer | 25
| Mike | Parrot | Designer | 35
| Alex | Funny | Engineer | 45
| Alex | Fellow | Designer | 29
| Alice | Young | Secretary | 20
--------------------------------------------------
The simplest way to represent data is to use QSqlTableModel and get a single table.
My question is, if it is possible to merge QTableView and QTreeView and represent result as a tree of tables, based by one of the fields, e.g. by "Profession":
+---Engineer:
| -------------------------------------------------
| | John | Smith | engineer | 25
| | Alex | Funny | engineer | 45
| -------------------------------------------------
|
+---Designer:
| -------------------------------------------------
| | Mike | Parrot | designer | 35
| | Alex | Fellow | designer | 29
| -------------------------------------------------
|
+---Secretary:
-------------------------------------------------
| Alice | Young | Secretary | 20
-------------------------------------------------
Thanks in advance for possible hints,
Xaleandr