[PyQt] New Style emit without subclassing

Demetrius Cassidy dcassidy36 at mass.rr.com
Tue Apr 7 22:18:18 BST 2009


Small Typo.. Should be:
self.emit(SIGNAL("itemClicked(QGraphicsSceneMouseEvent*)"))


Demetrius Cassidy wrote:
> 
> from PyQt4.QtCore import SIGNAL
> 
> class MyScene(QtGui.QGraphicsScene):
>    def __init__(self,parent=None):
>           QtGui.QGraphicsScene.__init__(self,parent)
>            self.emit(SIGNAL(("itemClicked(QGraphicsSceneMouseEvent*)")))
> 
>     
> ----- Original Message ----- 
> From: "Matt Smith" <melkor at orangepalantir.org>
> To: <pyqt at riverbankcomputing.com>
> Sent: Tuesday, April 07, 2009 3:17 PM
> Subject: [PyQt] New Style emit without subclassing
> 
> 
>> 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)
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 

-- 
View this message in context: http://www.nabble.com/New-Style-emit-without-subclassing-tp22936297p22938508.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list