我想在更改QTableWidet
排序指示符并对该表的数据进行排序之后调用某些函数。
我使用了水平标题的sortIndicatorChanged
信号,但是在数据排序之前就被调用了。
class MyDialog(Ui_MyWindowDialog, QtWidgets.QDialog):
def __init__(self, *args, **kwargs):
super(MyDialog, self).__init__(*args)
super(MyDialog, self).setupUi(self)
header_view = self.my_tbl_widget.horizontalHeader()
header_view.sortIndicatorChanged.connect(self.afterTableDataSorted)
def afterTableDataSorted(self, col, order):
'this is called before table data being sorted'
# my logic after table being sorted