[PyQt] signal/slot with parameter (QSignalTransition)

Philippe Crave philippe.crave at gmail.com
Wed Apr 14 20:16:34 BST 2010


Hi,

in a class, I have a QStateMachine, with some QState.
I would like to make a targetless transition for one state.
I followed the documentation here
http://qt.nokia.com/doc/4.6/statemachine-api.html#targetless-transitions

it works well if the initial event that launch the targetless transition
does not include any variables.
but now, I emit an event with an increment from a wheelEvent.
self.emit(SIGNAL("wheelEvent(int)"), inc)
I do not know how to propagate that value from that event to the target slot
function self.change_drive.

actually, I get this error message:
TypeError: change_drive() takes exactly 2 arguments (1 given)

here is a part of my class
...
t = QSignalTransition(self, SIGNAL("wheelEvent(int)"))
self.state_in.addTransition(t)
self.connect(t, SIGNAL("triggered()"), self.change_drive)

@pyqtSignature("int")
def change_drive(self, v):
    print 'change_drive', v

def wheelEvent(self, e):
    inc = cmp(e.delta(), 0) * -1
    self.emit(SIGNAL("wheelEvent(int)"), inc)

thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100414/4e7e4b21/attachment-0001.html>


More information about the PyQt mailing list