[PyQt] New Style emit without subclassing

Matt Smith melkor at orangepalantir.org
Wed Apr 8 12:45:35 BST 2009

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:


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


> From: "Demetrius Cassidy" <dcassidy36 at mass.rr.com>
> Subject: Re: [PyQt] New Style emit without subclassing
> To: <pyqt at riverbankcomputing.com>
> Message-ID: <285BC363D5E443C4983AF69EEC852F74 at Rahxephon>
> Content-Type: text/plain; format=flowed; charset="iso-8859-1";
>         reply-type=original
> from PyQt4.QtCore import SIGNAL
> class MyScene(QtGui.QGraphicsScene):
>    def __init__(self,parent=None):
>           QtGui.QGraphicsScene.__init__(self,parent)
> self.emit(SIGNAL(("itemClicked(QGraphicsSceneMouseEvent*)")))

More information about the PyQt mailing list