[PyQt] How can I add a QBomboBox to a QTreeView?

Martin B. ydkj14 at gmail.com
Sat Apr 5 13:17:52 BST 2014


I've created a QTreeView and a QStandardItemModel.
Then I add several rows and replace the item in the second column with a
combobox.

item = QStandardItem(text2)
model.appendRow([ QStandardItem(text1), item ])

cbx = QComboBox()
cbx.addItem("A")
cbx.addItem("B")

tvw.setIndexWidget(model.indexFromItem(item), cbx)

The problem is that the combobox doesn't show up. Instead text2 is shown.

What is wrong with this code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140405/30687259/attachment.html>


More information about the PyQt mailing list