I am using a QtableView to display data from a QSqlRelationalTableModel which seems to work fine, however when I use
self.motormodel.setRelation(1, QSqlRelation('Instruments', "Asset Tag","Description" )) self.ui.motorTableView.setItemDelegate(QSqlRelationalDelegate(self.ui.motorTableView))
to create a QSqlRelationalDelegate on the view and I try and sort the columns using the header of a column in the tableView the table doesn't refresh and I lose the model data in the view.
If I comment out the
self.motormodel.setRelation(1, QSqlRelation('Instruments', "Asset Tag","Description" ))
then it works as expected and the sort works.
Does anyone know what I am missing?