[PyQt] Getting raw x11 events

Tro troworld at gmail.com
Wed Mar 19 16:11:56 GMT 2008


On Wednesday 19 March 2008, Andreas Pakulat wrote:
> On 18.03.08 23:52:59, Tro wrote:
> > Hi.
> >
> > I'm trying to get at the raw x11 events by overriding the
> > x11ProcessEvent() method in my PyQt QApplication-derived class, but it's
> > never being called. In fact, QApplication doesn't seem to have a
> > x11ProcessEvent() method that I could override.
>
> QApplication does have that method, but it is not virtual so there's no
> way to override it and getting it called. What you probably want is
> x11EventFilter which is virtual and is exactly meant to be overriden in
> case you need X11 events.
>
> Andreas

Thanks, that method seems to exist, but it still isn't being called when I 
override it. Here's the test code:

class TestApplication(QApplication):
    def __init__(self, args):
        QApplication.__init__(self, args)
        
        self.mainwindow = MainWindow()
        self.maindialog = TestApp(None)
        
        self.maindialog.setupUi(self.mainwindow)
        
        self.mainwindow.show()
        
        self.exec_()
        
    def x11EventFilter(self, event):
        print event
        return True

The 'event' isn't ever being printed from x11EventFilter().

Thanks,
Tro


More information about the PyQt mailing list