Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlTableModel and QSqlQueryModel keep on communicating with database
Qt 6.11 is out! See what's new in the release blog

QSqlTableModel and QSqlQueryModel keep on communicating with database

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 637 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    whhfly2003
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved