TreeWidget — pyqtgraph 0.11.0rc0 documentation

# TreeWidget

class `pyqtgraph.` `TreeWidget`(parent=None)

  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.

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `addTopLevelItem`(self, item: PySide2.QtWidgets.QTreeWidgetItem)
  `addTopLevelItems`(self, items: typing.List[PySide2.QtWidgets.QTreeWidgetItem])
  `clear`(self)
  `dropEvent`(self, event: PySide2.QtGui.QDropEvent)
  `dropMimeData`(self, parent: PySide2.QtWidgets.QTreeWidgetItem, index: int, data: PySide2.QtCore.QMimeData, action: PySide2.QtCore.Qt.DropAction) → bool
  `insertTopLevelItem`(self, index: int, item: PySide2.QtWidgets.QTreeWidgetItem)
  `insertTopLevelItems`(self, index: int, items: typing.List[PySide2.QtWidgets.QTreeWidgetItem])
  `invisibleRootItem`(self) → PySide2.QtWidgets.QTreeWidgetItem
  `itemFromIndex`(index)

    Return the item and column corresponding to a QModelIndex.

  `itemMoving`(item, parent, index)

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

  `itemWidget`(self, item: PySide2.QtWidgets.QTreeWidgetItem, column: int) → PySide2.QtWidgets.QWidget
  `setColumnCount`(self, columns: int)
  `setItemWidget`(item, col, wid)

    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.

  `takeTopLevelItem`(self, index: int) → PySide2.QtWidgets.QTreeWidgetItem