[PyQt] How can I add a QBomboBox to a QTreeView?
bazwal at ftml.net
Sat Apr 5 19:54:27 BST 2014
On 05/04/14 13:17, Martin B. wrote:
> I've created a QTreeView and a QStandardItemModel.
> Then I add several rows and replace the item in the second column with a
> item = QStandardItem(text2)
> model.appendRow([ QStandardItem(text1), item ])
> cbx = QComboBox()
> 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?
Nothing. I would guess that you did not set the model on the treeview
before adding the items.
More information about the PyQt