[PyQt] ANN: PyQt v4.6 and SIP v4.9 Released

Phil Thompson phil at riverbankcomputing.com
Tue Sep 29 09:53:39 BST 2009


On Mon, 28 Sep 2009 12:59:52 -0700, Christian Caron <ccaron at fattoc.com>
wrote:
> I just upgraded and I get problems patching at the instance level.
> 
> I used to patch my own 'customEvent' on the QApplication at the  
> instance level. This doesn't work anymore.
> 
> Patching still works at the class level. The following code  
> illustrates this:
> 
> 
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> 
> class App(QApplication):
>      def customEvent(self, event):
>          print 'inherited', event
> 
> if __name__ == '__main__':
> 
>      def classPatch(self, event):
>          print 'classPatch', event
> 
>      def instancePatch(event):
>          print 'instancePatch', event
> 
>      # This still works
>      # App.customEvent = classPatch
> 
>      app = App([])
> 
>      # This used to work but doesn't anymore.
>      # app.customEvent = instancePatch
> 
>      QApplication.sendEvent(app, QEvent(1000))
> 
>      widget = QWidget()
>      widget.show()
> 
>      app.exec_()

Fixed in tonight's SIP snapshot. However, your instance patch needs a self
argument. If that worked before (and it's not a typo) then it was a bug.

Phil


More information about the PyQt mailing list