Results 1 to 2 of 2

Thread: Updating data in table view when related table is changed

  1. #1
    Join Date
    Jun 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Updating data in table view when related table is changed

    Consider the following scenario: I have 2 database tables, table1 and table2

    create table table1 (id int, name varchar(100));
    create table table2 (id int, name varchar(100), table1_id int);

    I use QSqlTableModel + QTableView to display id and name from table1, and
    QSqlRelationalTableModel + QTableView to display id and name from table2, and related name from table1.

    How do I make QTableView showing data from table2 pick up the changes made to table1 to display updated table1.name?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Updating data in table view when related table is changed

    This should be done out of the box by Qt if you are using the data view architecture correctly.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 1
    Last Post: 24th October 2010, 12:09
  2. Replies: 1
    Last Post: 3rd April 2010, 16:47
  3. Replies: 5
    Last Post: 3rd April 2010, 05:07
  4. Fetching data from table view
    By utkuaydin in forum Newbie
    Replies: 6
    Last Post: 19th January 2010, 08:27
  5. Table view->model->set data
    By tulsi in forum Qt Programming
    Replies: 3
    Last Post: 21st April 2009, 09:36

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.