[PyKDE] Reimplementing QApplication.notify

Konrad Hinsen hinsen at cnrs-orleans.fr
Fri Nov 29 21:37:01 GMT 2002


A rather annoying feature of Qtopia applications is that they are
terminated whenever the user presses the Esc key. On the Zaurus
developer list, I got the tip that this feature could only be disabled
by reimplementing QPEAppliction.notify, as no lower level ever gets to
see the key press event. So I tried

   class MyApplication(QPEApplication):

       def notify(self, receiver, event):
	   if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Escape:
	       pass
	   else:
	       return receiver.event(event)

   app = MyApplication(sys.argv)

but got nothing but the error message

   RuntimeError: No access to protected functions or signals for object
                 not created from Python

for the call to receiver.event(event).

Is there any way around this?

Konrad.




More information about the PyQt mailing list