[PyQt] New Style emit without subclassing

Phil Thompson phil at riverbankcomputing.com
Wed Apr 8 20:08:38 BST 2009


On Wed, 08 Apr 2009 07:45:35 -0400, Matt Smith <melkor at orangepalantir.org>
wrote:
> Thats not quite what I'm getting at.  That will emit the signal, which
> is the 'old style' but the new style is a bit different, and after you
> set it up you emit the signal by using:
> 
> 	mysignal.emit(args)
> 
> My question is that the only way I know how to make a 'new style' signal
> emittable is via creating a class attribute, ie:
> 
> class MyScene(QtGui.QGraphicsScene):
>     mysignal = QtCore.pyqtSignal(QtGui.QGraphicsSceneMouseEvent)
>     def __init__(self,parent):
>         #normal init stuff

You can only define new signals (that Qt knows about) in a sub-class. That
goes for both old-style and new-style.

Phil


More information about the PyQt mailing list