I have a QTableWidget that has a combination of QLineEdit and normal table cell items. I would like to know the best way to sort the data in the table by the values in the QLineEdit column.
Here is an example.
| 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 |
I would like to sort on the customer code column but because it’s a QLineEdit (set with setCellWidget()), the table won’t sort by its values.
I know I could take each value out, place them in a temporary object or row and shuffle the rows around but that would be amazingly ugly and slow. Is there a better way to do this?
There are several ways to approach this, here are a couple of ideas: