[PyQt] Getting raw x11 events
Phil Thompson
phil at riverbankcomputing.com
Wed Mar 19 16:37:03 GMT 2008
On Wednesday 19 March 2008, Tro wrote:
> 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().
That's because PyQt doesn't include x11EventFilter() because I'm not wrapping
XEvent.
Phil
More information about the PyQt
mailing list