<br><br><div class="gmail_quote">2010/4/14 Philippe Crave <span dir="ltr">&lt;<a href="mailto:philippe.crave@gmail.com">philippe.crave@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<span style="font-family:courier new,monospace">Hi,<br><br>in a class, I have a QStateMachine, with some QState.<br>I would like to make a targetless transition for one state.<br>I followed the documentation here<br><a href="http://qt.nokia.com/doc/4.6/statemachine-api.html#targetless-transitions" target="_blank">http://qt.nokia.com/doc/4.6/statemachine-api.html#targetless-transitions</a><br>


<br>it works well if the initial event that launch the targetless transition does not include any variables.<br>but now, I emit an event with an increment from a wheelEvent.<br></span><span style="font-family:courier new,monospace">self.emit(SIGNAL(&quot;wheelEvent(int)&quot;), inc)</span><br>


<span style="font-family:courier new,monospace">I do not know how to propagate that value from that event to the target slot function </span><span style="font-family:courier new,monospace">self.change_drive</span><span style="font-family:courier new,monospace">.<br>


<br>actually, I get this error message:<br>TypeError: change_drive() takes exactly 2 arguments (1 given)<br><br>here is a part of my class<br>...<br>t = QSignalTransition(self, SIGNAL(&quot;wheelEvent(int)&quot;))</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">self.state_in.addTransition(t)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">self.connect(t, SIGNAL(&quot;triggered()&quot;), self.change_drive)</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">       </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">@pyqtSignature(&quot;int&quot;)</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">def change_drive(self, v):</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    print &#39;change_drive&#39;, v</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">       </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> def wheelEvent(self, e):</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">    inc = cmp(e.delta(), 0) * -1</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    self.emit(SIGNAL(&quot;wheelEvent(int)&quot;), inc)</span><br style="font-family:courier new,monospace">


<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">thank you</span><br style="font-family:courier new,monospace">
<br>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>

I think this is happening because the &quot;triggered()&quot; signal doesn&#39;t emit any argument. So, the callback is not receiveing any argument but the &quot;self&quot; argument. Probably that is the reason.</div><div>

<br></div><div>I hope this helps you.</div><div><br></div><div>Regards,</div><div>Thiago Zanetti</div></span></div>