Results 1 to 2 of 2

Thread: Does QSqlTableModel::select emit dataChanged/rowsInserted signals?

  1. #1

    Default Does QSqlTableModel::select emit dataChanged/rowsInserted signals?

    I modify database externally then call QSqlTableModel::select to reload the model. I expect dataChanged/rowsInserted signal emitted but it is actually not. How do I capture the information about the change of the database?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,695
    Thanks
    259
    Thanked 753 Times in 743 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Does QSqlTableModel::select emit dataChanged/rowsInserted signals?

    The model is probably sending layoutChanged() and/or modelReset() signals since the result of a query generally means the entire content of the model has changed.

    The other signals imply that most of the model is unchanged, only the rows / columns / data ranges notified in the signal are modified. That's not the case here, and if the new results have a different number of rows than the previous, it could cause views to malfunction.
    Last edited by d_stranz; 16th March 2020 at 17:54.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Proxy model invalidation after dataChanged() emit
    By lotek in forum Qt Programming
    Replies: 2
    Last Post: 3rd February 2011, 12:21
  2. QSqlTableModel & datachanged()
    By noValue in forum Newbie
    Replies: 5
    Last Post: 26th November 2010, 01:26
  3. Replies: 0
    Last Post: 19th July 2010, 09:48
  4. QSqlTableModel::select()
    By vladozar in forum Qt Programming
    Replies: 4
    Last Post: 29th April 2009, 18:51
  5. emit Signals
    By Fastman in forum Qt Programming
    Replies: 5
    Last Post: 22nd August 2007, 14:14

Tags for this Thread

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.