PDA

View Full Version : QSqlRelationalTableModel



jjay
20th February 2008, 01:43
Hi all,

I want to use multi-relation in a QTableView to follow more than only 1 relation. Do you know if is it possible ?


Let me explain with an example :

There are 3 Table : User - Town and Country like this :


------------------ ------------------ ------------------
| USER | | TOWN | | COUNTRY |
------------------ ------------------ ------------------
| user_id | |-->| town_ID | |-->| Country_id |
| Name | | | Name | | | Name |
| town_link |---| | Country_link |---| | |
| | | | | |
------------------ ------------------ ------------------

And this is that i want to display in my QTableView using a QSqlRelationalTableModel :


---------------------------------------------------
| USER | TOWN | COUNTRY |
---------------------------------------------------
| john | Londres | Angleterre |
| paul | Lyon | France |
| truc | Paris | France |
| pierre | Lausane | Suisse |
| jasmin | Oslo | Norvège |
| dan | Cupertino | USA |
---------------------------------------------------

Is it possible to do that only with QTableView and QSql(Relational)TableModel ?

Thanks

jjay

jpn
20th February 2008, 16:20
At least it's possible with QSqlQueryModel.