Important: Please read the Qt Code of Conduct -

QSqlRelationalDelegate commit data behavior

  • Hi all, I have a QTableView that gets its data from a QSqlRelationalTableModel. I have used QSqlRelationalDelegate as my delegate to be able to show the comboboxs in my table. I also set the edit strategy to manual so that I can submit the data when the user press a "submit" button. Now the problem is that unless the user hit the Return key the edited data would not be committed to the model. That means the changes would not be reflected to the database unless the user first hit Return and then press the "submit" button on the form. Would someone tell me is there any way to change this behavior of my delegate (commit the changes to the model for say just by clicking the "submit" button and not hitting Return) or do I need to implement my own delegate, please?

  • I guess I can also get edited data from delegate editor and insert it into database with a qsqlquery. But I even can't access to the editor. Any idea?


Log in to reply