Results 1 to 2 of 2

Thread: long sql result slow QTableView

  1. #1
    Join Date
    Oct 2007
    Posts
    65
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question long sql result slow QTableView

    Hello,
    i have any queries that returns a somewhat large (not too much) number of rows (about 5000 with 7~8 columns), i am using now QSqlQueryModel in a QTableView, the problem it is the load at startup (and when i have to refresh the table for an update), i have thought to use a secondary thread to populate the list of the results in the background, should this work ok? maybe i am missing anything better integrated in qt?

    About the changes in a sql querymodel result do i have any way to update only the row changed without have to make my own model caching the data and emiting dataChanged at finish? i would like qt would have a signal when the underlying sql data has been changed or anything alike.

    Regards,
    Miguel Angel.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: long sql result slow QTableView

    Yeah, that's ok. Just remember you should share a single database connection across threads.

    As for your second question - in PostgreSQL you can subscribe to notifications when the database changes. For other backends, I don't think this is currently possible, they don't support notifications.

  3. The following user says thank you to wysota for this useful post:

    skuda (20th January 2009)

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.