Answer the question
In order to leave comments, you need to log in
QSqlTableModel + QTreeView adding entry
I'm trying to connect the model and views to display data from the database. The model is QSqlTableModel, the views are QTreeView.
Adding a new entry is successful, but a message appears in the Application Output Qt Creator:
Unable to free statement: connection pointer is NULL
I think this is due to the fact that when adding a new line I do not specify the parent, but I'm not sure.
Add code:
qint32 nIndex = databaseModel->rowCount();
databaseModel->insertRow(nIndex);
databaseModel->setData(databaseModel->index(nIndex, 2), title);
databaseModel->submitAll();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question