QSql: Wrong column displayed when using OnFieldChange!
-
I have a QSqlDatabase with two tables, a main table with about 1839 records and a category table with three record. The second table has only two columns, id and category.
@model = new QSqlRelationalTableModel(this, db);
model->setTable("Main");
model->setEditStrategy(QSqlTableModel::OnFieldChange);
model->setRelation(1, QSqlRelation("categories", "id", "category"));
model->select();view = new QTableView;
view->setModel(model);
view->setItemDelegate(new QSqlRelationalDelegate);@When I start the program, everything is just fine. But whenever I change the category, instead of the new string the id is displayed until I call model->select() manualy.
When I use OnManualSubmit, I have to call model->submitAll() before proceeding.How can I make sure the value of category is displayed when using OnFieldChange?