Is there something similar to the (PyQT)
QTreeWidgetItem.setCheckState(0, Qt.Checked)
but for the combo box?
I can't see anything in the reference, so how can I insert a custom QComboBox as one of the elements within QTreeWidgetItem?
Is there something similar to the (PyQT)
QTreeWidgetItem.setCheckState(0, Qt.Checked)
but for the combo box?
I can't see anything in the reference, so how can I insert a custom QComboBox as one of the elements within QTreeWidgetItem?
Use QTreeWidget::setItemWidget ( QTreeWidgetItem * item, int column, QWidget * widget ) to put the combo box into the cells.
For example, let's make all rows of the second column of a 2-column QTreeWidget to all be combo boxes:
Our example widget now looks like this:
I know this is an old question but I think I have a more thorough answer. To get any functionality out of the QComboBox, you'll probably need to subclass it. Here's the solution that I came up with:
I hope that helps someone in need of a QComboBox inside of a QTreeWidgetItem!
This is easiest method:
Use
.Just add your QComboBox() as a parameter, as it inherits QWidget() so it is compatible.
Here is small fix to the another posters method. I found that is uses Data to update the box How ever I made small change to setText updater for the method.