<span style="font-family: courier new,monospace;">is there a workaround ?</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&quot;triggered()&quot; is the only signal available in QSignaltransition :/</span><br style="font-family: courier new,monospace;">
<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">actually, maybe I don&#39;t try to solve my issue the right way.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">I have a stateMachine.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">when I am in a State, I modify some properties, but I would like my state to perform some things under some condition (event).</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">that&#39;s why I wanted to use a targetLess Transition.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">imagine that I have state_1, 2, 3, and some sub_states under each.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">They all do something different (or nothing) while the user scroll the mouse wheel.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Of course, I could simply do:</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;">    and then, testing in which State I am, and so on.</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">but that was not so much the way I thought we should use a stateMachine.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">I liked the fact that I could define all my stateMachine in one single place, not mixing it with fonctions that emit events.</span><br><br><br><div class="gmail_quote">2010/4/14 Thiago Zanetti <span dir="ltr">&lt;<a href="mailto:thiago.project@gmail.com">thiago.project@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br><br><div class="gmail_quote">2010/4/14 Philippe Crave <span dir="ltr">&lt;<a href="mailto:philippe.crave@gmail.com" target="_blank">philippe.crave@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">

<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></div></div>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">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>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>
</blockquote></div><br>