Reputation: 81
I am building a database for my work. I want to be able to sort the elements in a manner similar to how you can sort elements in excel by clicking the header of a column. I am using the pandas library so I plan on sorting with that, but my main question is is there a way to run code when a header is clicked in a QTableWidget? Or is this not possible?
Upvotes: 5
Views: 6884
Reputation: 385
You can do that by using the property of the QtableView :
table = QtWidgets.QTableWidget()
table.setSortingEnabled(True)
Upvotes: 14