Reputation: 3081
I have a QTableWidget
with many columns and I want to allow sorting only by specific columns. Enabling sorting for the whole table with setSortingEnabled(1)
makes the table sortable by all columns,
In this example
Name Read Comment
whatever1 0 bla
whatever2 0 bla
whatever3 1 bla
I want to sort the table only by column "Read" and only with the operator <
.
Is there a function or slot that I can execute after each cell changes?
self.ui.table.connect.cellChanged(self.sort_by_read)
Upvotes: 1
Views: 3632
Reputation: 2801
There exists PySide.QtGui.QTableWidget.sortItems(column[, order=Qt.AscendingOrder])
for sorting items by one specific column.
Upvotes: 1