Source code for prettyqt.widgets.tablewidget

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

from qtpy import QtWidgets, QtCore

from prettyqt import widgets


QtWidgets.QTableWidget.__bases__ = (widgets.TableView,)


[docs]class TableWidget(QtWidgets.QTableWidget): 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 = TableWidget() widget.show() app.exec_()