I have a QTableView with QAbstractTableModel which contains a ComboBox delegate created with QItemDelegate. All this is working fine.
Now I want to add filtering/sorting capability on this view so I used QSortFilterProxyModel like this
self.table_model = DictionaryTableModel() # created with QAbstractTableModel self.delegate = ComboDelegate(self) self.ui.table_view.setItemDelegateForColumn(2, self.delegate) self.proxy_model = QtCore.QSortFilterProxyModel(self) self.proxy_model.setSourceModel(self.table_model) # set the model self.ui.table_view.setModel(self.proxy_model)
Now here sorting works but I lose my delegate from the column and get a NoneType if I try to query this delegate which means that delegate never made it to the proxy model and I have no idea how to fix this.
Please help if anyone has a clue on how to sort this issue.