0
我有一個QTableWidget,它具有QLineEdit和普通表單元格項的組合。我想知道通過QLineEdit列中的值對錶中的數據進行排序的最佳方法。按QLineEdit在QTableWidget中排序
這裏是一個例子。
| 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設置())表不會排序它的價值。
我知道我可以拿出每個值,將它們放置在一個臨時對象或行中,然後對這些行進行混洗,但這會非常難看和緩慢。請告訴我,在Qt中有更好的方法來做到這一點!
第三種方法是轉換爲使用models/views/delegates,這使得排序非常簡單。 –