我有QTableWidget
,其中包含QLineEdit
和普通表格单元格项的组合。我想知道按QLineEdit
列中的值对表格中的数据进行排序的最佳方法。
这是一个例子。
| customer code | header | message |
------------------------------------------------
| QLineEdit | normal cell | normal cell |
| QLineEdit | normal cell | normal cell |
| QLineEdit | normal cell | normal cell |
| QLineEdit | normal cell | normal cell |
| QLineEdit | normal cell | normal cell |
我想对客户代码列进行排序,但由于它是QLineEdit
(使用setCellWidget()
设置),因此表格不会按其值排序。
我知道我可以把每个值都取出来,把它们放在一个临时的物体或行中,然后将行放在一边,但这样会非常难看和缓慢。有更好的方法吗?
答案 0 :(得分:1)
有几种方法可以解决这个问题,这里有几个想法: