As the title suggests I'm looking to get a combobox in a QTableView. I've looked at several other questions that deal with comboboxes in tableviews, but they mostly concern comboboxes as editors and that is not what I'm looking for.
I would like the combobox to be visible at all times and get its data from the underlying model. It doesn't have to set data in the model.
I tried to adapt this example of a progress bar delegate: How to include a column of progress bars within a QTableView? Leading to this code:
class ComboDelegate(QStyledItemDelegate):
def paint(self, painter, option, index):
combo = QStyleOptionComboBox()
combo.rect = option.rect
combo.currentText = 'hallo' # just for testing
combo.editable = True
combo.frame = False
QApplication.style().drawComplexControl(QStyle.CC_ComboBox, combo, painter)
But this gives me a greyed out, non functional combobox.
How do you get a functional combobox there?