Skip to content Skip to sidebar Skip to footer

Qtextedit As A Child Node For Qtreewidgetitem?

Is it possible to add a QTextEdit as a child in QTreeWidget? Here is my code we can create a QTreeWidget and add the columns: self.treetext = QtGui.QTreeWidget(self.dockWidgetConte

Solution 1:

You can set a widget on any item in the tree using setItemWidget

self.treetext.setItemWidget(item_1, 0, QTextEdit(self))

If your tree widget items are editable, you can also just tell Qt to open a persistent editor (by default, QTreeWidgetItems use a QLineEdit for editing, but you can override that behavior with a QItemDelegate if you want) using openPersistentEditor()

self.treetext.openPersistentEditor(item_1, 0)

Post a Comment for "Qtextedit As A Child Node For Qtreewidgetitem?"