Qt6, save TableView record in the database
-
I am adding a new entry to my
TableView
so: ```
model->insertRow(model->rowCount()); And then I fill all the cells. How can I now save this data in the database?
-
I am adding a new entry to my
TableView
so: ```
model->insertRow(model->rowCount()); And then I fill all the cells. How can I now save this data in the database?
@MyNick-0 said in Qt6, save TableView record in the database:
How can I now save this data in the database?
Read the data out of your model and create a QSqlQuery to put it into your database
Or use a QSqlQueryModel in the first place.
-
@MyNick-0 said in Qt6, save TableView record in the database:
How can I consider the data from the model
You set data with setData() and retrieve it with data() as you should already know - if not please read the documentation about Qt's model/view framework
can you bring the code?
I don't write code for others when they don't provide code by themself in the first place so I see that they thought about the problem and tried things out by themself.