QSqlTableModel and QSqlQueryModel keep on communicating with database

  • 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.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.