[PyQt] QSignalTransition

Fx III fxiiii at gmail.com
Mon Jun 21 08:59:49 BST 2010


Hi all,
QSignalTransition does not accept signals when come from python extent.
When I try the following test program I get:

QSignalTransition: no such signal: Emitter::mySignal()

this is program

import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui
from pprint import pprint

class Emitter(QtGui.QPushButton):
    def __init__(self,parent=None):
        QtGui.QPushButton.__init__(self,parent)
        QtCore.QObject.connect(self,QtCore.SIGNAL("clicked()"),self.emitter)
    def emitter(self):
        print "emitting"
        self.emit(QtCore.SIGNAL("mySignal()"))


app=QtGui.QApplication([""])
emitter=Emitter()
emitter.show()
machine=QtCore.QStateMachine()
state1=QtCore.QState(machine)
state2=QtCore.QState(machine)
t = QtCore.QSignalTransition(emitter,QtCore.SIGNAL("mySignal()"));
t.setTargetState(state2);
state1.addTransition(t);
QtCore.QObject.connect(state2,QtCore.SIGNAL("entered()"),

 lambda:pprint("ENTERED!!!"))
machine.setInitialState(state1)
machine.start()
app.exec_()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100621/133dd397/attachment.html>


More information about the PyQt mailing list