Results 1 to 2 of 2

Thread: QSqlRelationalTableModel

  1. #1
    Join Date
    Feb 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    MacOS X

    Default QSqlRelationalTableModel

    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 :

    Qt Code:
    1. ------------------ ------------------ ------------------
    2. | USER | | TOWN | | COUNTRY |
    3. ------------------ ------------------ ------------------
    4. | user_id | |-->| town_ID | |-->| Country_id |
    5. | Name | | | Name | | | Name |
    6. | town_link |---| | Country_link |---| | |
    7. | | | | | |
    8. ------------------ ------------------ ------------------
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. ---------------------------------------------------
    2. | USER | TOWN | COUNTRY |
    3. ---------------------------------------------------
    4. | john | Londres | Angleterre |
    5. | paul | Lyon | France |
    6. | truc | Paris | France |
    7. | pierre | Lausane | Suisse |
    8. | jasmin | Oslo | Norvège |
    9. | dan | Cupertino | USA |
    10. ---------------------------------------------------
    To copy to clipboard, switch view to plain text mode 

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

    Thanks

    jjay

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QSqlRelationalTableModel

    At least it's possible with QSqlQueryModel.
    J-P Nurmi

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.