[PyQt] New Style emit without subclassing

Matt Smith melkor at orangepalantir.org
Tue Apr 7 20:17:06 BST 2009


I'm not clear on how to make an object emit a signal without
subclassing, with the new style emits.

ie, old style:

    myscene.emit(
        QtCore.SIGNAL("itemClicked(QGraphicsSceneMouseEvent*)"
        ,ev
        )

Where as if I subclass:

    class MyScene(QtGui.QGraphicsScene):
        touchedItem = QtCore.pyqtSignal( QtGui.QGraphicsSceneMouseEvent)
        def __init__(self,parent=None):
            QtGui.QGraphicsScene.__init__(self,parent)

then I could use

myscene.touchedItem.emit(ev)







More information about the PyQt mailing list