class pyqtgraph.TreeWidget(parent=None)[source]#

Extends QTreeWidget to allow internal drag/drop with widgets in the tree. Also maintains the expanded state of subtrees as they are moved. This class demonstrates the absurd lengths one must go to to make drag/drop work.


Return the item and column corresponding to a QModelIndex.

itemMoving(item, parent, index)[source]#

Called when item has been dropped elsewhere in the tree. Return True to accept the move, False to reject.

setItemWidget(item, col, wid)[source]#

Overrides QTreeWidget.setItemWidget such that widgets are added inside an invisible wrapper widget. This makes it possible to move the item in and out of the tree without its widgets being automatically deleted.