Results 1 to 2 of 2

Thread: making a change in an SQL table/qsqltablemodel appear in two qsqltableviews?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X

    Default making a change in an SQL table/qsqltablemodel appear in two qsqltableviews?

    At times a user of my application may have open two tableviews looking at the same underlying SQL table. Each tableview has its own QSqlTableModel.
    If they edit data in one tablemodel, I would like that change to be immediately reflected in the other tableview at the same time. Is there a neat signal/slot way to do this? What is the most elegant way to go about it?

    thanks

    John
    Learning, one problem at a time.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: making a change in an SQL table/qsqltablemodel appear in two qsqltableviews?

    The most elegant way is to use only one model for both views.

    But, you could always update the other model when the first one changed. I guess you could just use select() again.

Similar Threads

  1. Replies: 1
    Last Post: 3rd February 2010, 06:01
  2. Replies: 7
    Last Post: 13th May 2009, 00:26
  3. Making Table cell as a combobox?
    By kaushal_gaurav in forum Qt Programming
    Replies: 9
    Last Post: 1st August 2008, 12:04
  4. Making one row colorful of a table in qt3
    By omprakash in forum Qt Programming
    Replies: 1
    Last Post: 26th July 2008, 00:11
  5. QSqlTableModel cannot change values
    By raphaelf in forum Newbie
    Replies: 2
    Last Post: 23rd May 2007, 08:01

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
  •  
Qt is a trademark of The Qt Company.