G
G
gagoman2011-03-31 23:29:34
Qt
gagoman, 2011-03-31 23:29:34

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();


databaseModel is a variable of type QSqlTableModel.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question