A small question on the implementation of the query in the database. There is a qtablebiew in which there are 8 columns and several dozen rows. This data needs to be transferred to the database on sqlite. Actually a question. I can pick one line at a time and make a "insert into" request each time, thereby transferring one line to the database. But is there a more rational way. For example, transfer all one request?

  • For example, you can use the model for working with the sql-database: doc.qt.io/Qt-5/qsqltablemodel.html#details To manually tell the model to commit all changes in the table: doc.qt.io/Qt-5/qsqltablemodel.html #submitAll - gil9red
  • And for the purpose of computer resources, which is more profitable to use in this situation? qsqlquery or is it worth to think about qsqltablemodel? - MEOW 1:01 pm
  • First, do as it is more convenient. Those. Try both approaches and rate them. But, qsqltablemodel, it will be more effective, for example, when committing it, judging by the description of the method, it commits only those values ​​that have changed, because the table model knows what has been edited. - gil9red 1:22 pm
  • I have difficulty understanding how the data is sampled from the qtableview to the qsqltable model, because in all the guides the data is taken from the database to the tableview, and I need the opposite. Do not hint how to do it? - MEOW pm
  • You will need to create your table and models in the database, specify a link to the database (QSqlDatabase, but you can not specify if there is only one connection) and the table itself via setTable (see the example doc.qt.io/Qt-5/qsqltablemodel. html # details ) - gil9red pm

0