Important: Please read the Qt Code of Conduct -

QtSql.RelationalTableModel weird behavior

  • Hi Everyone,

    I am using QtSql.RelationalTableModel and I have setRelation defined. setRelation just seems to act really really weird. If I add a new row and then click the cell that the relation is based on up comes a combobox. I select the value and then I click on a different cell. The value that is returned is the id value. When I go to hit enter to add the row it does not get added. Do I need to do anything in the delegate to get this to work?

    Also why when I do self.model.insertRow(row) does it not automatically add the row to the database? It is only after I fill in the information that the row id gets added.

    I am sure that it is user error, but has anyone else come across this?

    Thank you,

Log in to reply