Qt 6.11 is out! See what's new in the release
blog
QSqlTableModel and QSqlQueryModel keep on communicating with database
General and Desktop
1
Posts
1
Posters
637
Views
1
Watching
-
I found that if you use the data() method from QSqlTableModel or QSqlQueryMode to fetech the data in the model, they will keep on communicating with database. I check the source code of QSqlQueryMode and I found that it use seek method to get the data.
So if you do a loop to fetech all the data from the model, it will be very slow if there is a network lag. Can someone give me a suggestion to fix this problem. My solution is give up model and use QSqlQuery with setForwardOnly but I like QSqlTableModel as it is very convenient with QTableView to show you data or save you data. Thanks all.