[PyKDE] problem with event filter?

David Boddie david at boddie.org.uk
Fri Nov 17 22:13:18 GMT 2006


On Fri, 17 Nov 2006 12:11:55 -0900, Patrick Stinson wrote:

>Does QObject.eventFilter work as it is supposed to? My eventFilter
>method never gets called, even after typing in the line edit...
>
>class SpinBox(QSpinBox):
>    def __init__(self, parent=None):
>        QSpinBox.__init__(self, parent)
>        self.installEventFilter(self.lineEdit())
>
>    def eventFilter(self, o, e):
>        print o, e
>        if o == self.lineEdit():
>            print e.isDoubleClick()

You've got it the wrong way round: you set the event filter on the object
you want to watch:

  http://doc.trolltech.com/4.2/qobject#installEventFilter

It's a common mistake. I have to look it up every time I use it, just to
make sure. :-)

David


___________________________________________________________
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com




More information about the PyQt mailing list