[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] [QTtableWidget] detect click on column header?
From:       Lara Michaels <laramichaels1978 () yahoo ! com>
Date:       2010-02-20 23:44:52
Message-ID: 171660.50422.qm () web111809 ! mail ! gq1 ! yahoo ! com
[Download RAW message or body]

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:

class MyQTableWidget(QTableWidget):

   def sortByColumn(self, col, order): 
       print 'called!'


What am I doing wrong to implement my own sortByColumn?

Many thanks for any advice

lara

--- On Sat, 2/20/10, Lara Michaels <laramichaels1978@yahoo.com> wrote:

> From: Lara Michaels <laramichaels1978@yahoo.com>
> Subject: [PyQt] [QTtableWidget] detect click on column header?
> To: pyqt@riverbankcomputing.com
> Date: Saturday, February 20, 2010, 11:06 PM
> 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
> 
> 
> 
> 
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 


      

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic