Source code for prettyqt.widgets.treewidget

# -*- coding: utf-8 -*-
"""
@author: Philipp Temminghoff
"""

from qtpy import QtWidgets, QtCore

from prettyqt import widgets


QtWidgets.QTreeWidget.__bases__ = (widgets.TreeView,)


[docs]class TreeWidget(QtWidgets.QTreeWidget): def sort(self, column=0, reverse=False): order = QtCore.Qt.DescendingOrder if reverse else QtCore.Qt.AscendingOrder self.sortItems(column, order)
if __name__ == "__main__": app = QtWidgets.QApplication([]) widget = TreeWidget() widget.show() app.exec_()