[PyQt] [QTtableWidget] detect click on column header?

Lara Michaels laramichaels1978 at yahoo.com
Sat Feb 20 23:06:45 GMT 2010


Hello,

I am trying to allow items in a QTableWidget to be sorted by date. Difficulty: I want to display the date to the user in a human-friendly way, yet be able to sort on that column.

What I have done is I have created a hidden column with a UNIX timestamp corresponding to that date, on which lexicographic sorting will generate the correct results. I need your help with the following:

- how can I intercept a click on a(n horizontal) header of a QTableWidget? I have tried defining its mousePressEvent() method, but it does not get called when the user clicks on a *header* (it does when the user clicks on a normal cell).

Many thanks for any help

lara


      



More information about the PyQt mailing list