PDA

View Full Version : long sql result slow QTableView



skuda
19th January 2009, 20:14
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.

wysota
20th January 2009, 09:41
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.