[PyQt] [QTtableWidget] detect click on column header?
laramichaels1978 at yahoo.com
Sat Feb 20 23:44:52 GMT 2010
My apologies, I have figured out that I need to listen to the QHeaderView's sectionClicked(int) signal.
But I am still stuck. How do I override the function that normally does the sorting? I tried subclassing from QTableWidget and reimplementing sortByColumn(), but my function never gets called:
def sortByColumn(self, col, order):
What am I doing wrong to implement my own sortByColumn?
Many thanks for any advice
--- On Sat, 2/20/10, Lara Michaels <laramichaels1978 at yahoo.com> wrote:
> From: Lara Michaels <laramichaels1978 at yahoo.com>
> Subject: [PyQt] [QTtableWidget] detect click on column header?
> To: pyqt at riverbankcomputing.com
> Date: Saturday, February 20, 2010, 11:06 PM
> 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
> 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
> PyQt mailing list PyQt at riverbankcomputing.com
More information about the PyQt