Important: Please read the Qt Code of Conduct -

Storing Changes from TableView to Model to SQLITE Database

  • Hello,

    After reading the Qt documentation and playing around with some code I am still a bit confused as to what each part of my code that stores changes to my database actually does. I have the following code:

    @ database->pointsTableModel->database().transaction();

    I am unsure as to whether all three of these calls are necessary to save the changes to my persistent database. In leyman's terms what exactly does transaction() do? Instead of calling submitAll() can I just go straight to commit()?


  • You really should not need all of these calls. One of these should be sufficient:

    The "QSqlTableModel": should be already pointing to your database.

Log in to reply