[PyQt] eventFilter not executed

Alessandro Re akirosspower at gmail.com
Wed Oct 29 15:58:16 GMT 2008


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?

-- 
~Ale


More information about the PyQt mailing list