[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] eventFilter not executed
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2008-10-29 16:03:36
Message-ID: f4c547f0e0e3278829d4340657a705c0 () localhost
[Download RAW message or body]
On Wed, 29 Oct 2008 15:58:16 +0000, "Alessandro Re"
<akirosspower@gmail.com> wrote:
> I hate double-posting, but i guess here it's a more appropriate place
> where to ask
>
(http://www.qtcentre.org/forum/f-newbie-4/t-pyqt4-doesnt-execute-eventfilter-16734.html)
>
> I'm trying to filter some events, but it seems that eventFilter()
> isn't executed in the filter object.
> I did this example and the message is never printed
>
> #!/usr/bin/python
>
> import sys
> from PyQt4.QtGui import *
> from PyQt4.QtCore import *
>
> class SomeFilter(QObject):
> def eventFilter(self, obj, ev):
> print("Event filtering ok")
> return False
>
> class MainWidget(QMainWindow):
> def __init__(self):
> QMainWindow.__init__(self)
> self.installEventFilter(SomeFilter())
>
> app = QApplication(sys.argv)
> w = MainWidget()
> w.show()
> sys.exit(app.exec_())
>
> Am I using this in the wrong way?
Your filter object is being immediately garbage collected.
Phil
_______________________________________________
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