<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[qtscxml: connect to signals]]></title><description><![CDATA[<p dir="auto">I'm playing with qtscxml and I'm running into a problem - here is a simple state machine</p>
<p dir="auto">&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;!-- enable-qt-mode: yes --&gt;<br />
&lt;scxml xmlns="<a href="http://www.w3.org/2005/07/scxml" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.w3.org/2005/07/scxml</a>" xmlns:qt="<a href="http://theqtcompany.com/scxml/2015/06/" target="_blank" rel="noopener noreferrer nofollow ugc">http://theqtcompany.com/scxml/2015/06/</a>" version="1.0" name="KeyboardStateMachine" initial="s1"&gt;</p>
<pre><code>&lt;state id="s1"&gt;
    &lt;onentry&gt;
      &lt;log expr="Now in s1" /&gt;
      &lt;send event="enter_state1"/&gt;
    &lt;/onentry&gt;
    &lt;transition event="key_pressed" target="s2"/&gt;
&lt;/state&gt;
&lt;state id="s2"&gt;
    &lt;onentry&gt;
        &lt;log expr="Now in s2" /&gt;
        &lt;send event="enter_state2"/&gt;
    &lt;/onentry&gt;
    &lt;transition event="key_released" target="s1"/&gt;
&lt;/state&gt;
</code></pre>
<p dir="auto">&lt;/scxml&gt;</p>
<p dir="auto">I want to connect to the signals enter_state1 and enter_state2 on the c++ side.</p>
<p dir="auto">QObject::connect(machine, SIGNAL(enter_state1()), this, SLOT(keyLedOff()));<br />
QObject::connect(machine, SIGNAL(enter_state1()), this, SLOT(lkeyLedOon()));</p>
<p dir="auto">but I get an error: QObject::connect: No such signal KeyboardStateMachine::enter_state1()</p>
<p dir="auto">What I'm I doing wrong here?</p>
]]></description><link>https://forum.qt.io/topic/70538/qtscxml-connect-to-signals</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Nov 2026 18:37:28 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/70538.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 Aug 2016 01:21:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to qtscxml: connect to signals on Wed, 24 Aug 2016 21:45:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/larry104">@<bdi>larry104</bdi></a><br />
good found :)</p>
]]></description><link>https://forum.qt.io/post/344035</link><guid isPermaLink="true">https://forum.qt.io/post/344035</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 24 Aug 2016 21:45:48 GMT</pubDate></item><item><title><![CDATA[Reply to qtscxml: connect to signals on Wed, 24 Aug 2016 21:39:13 GMT]]></title><description><![CDATA[<p dir="auto">I found the problem - to create a qt signal I need to set the following:</p>
<p dir="auto">&lt;send type="qt:signal" event="enter_state1"/&gt;</p>
]]></description><link>https://forum.qt.io/post/344030</link><guid isPermaLink="true">https://forum.qt.io/post/344030</guid><dc:creator><![CDATA[larry104]]></dc:creator><pubDate>Wed, 24 Aug 2016 21:39:13 GMT</pubDate></item><item><title><![CDATA[Reply to qtscxml: connect to signals on Wed, 24 Aug 2016 20:12:43 GMT]]></title><description><![CDATA[<p dir="auto">Hmm, seems to follow the docs closely so should be ok.<br />
STATECHARTS should make qmake run tool. ?</p>
<p dir="auto">I wonder how connect can possible work then if no signals generated. are they somehow exported from QML?</p>
<p dir="auto">Sorry, i have never used this new module so Im afraid we must<br />
hope for others to have better suggestions :)</p>
]]></description><link>https://forum.qt.io/post/344001</link><guid isPermaLink="true">https://forum.qt.io/post/344001</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 24 Aug 2016 20:12:43 GMT</pubDate></item><item><title><![CDATA[Reply to qtscxml: connect to signals on Wed, 24 Aug 2016 18:59:02 GMT]]></title><description><![CDATA[<p dir="auto">1: is done<br />
#ifndef KEYBOARD_H<br />
#define KEYBOARD_H</p>
<p dir="auto">#include &lt;QObject&gt;<br />
#include &lt;QHash&gt;<br />
#include &lt;QColor&gt;<br />
#include &lt;QDebug&gt;<br />
#include "statemachine.h"</p>
<p dir="auto">class Keyboard : public QObject<br />
{<br />
Q_OBJECT</p>
<p dir="auto">public:<br />
explicit Keyboard(QHash&lt;QString,  QObject*&gt; keys, QObject *parent = 0);</p>
<p dir="auto">signals:</p>
<p dir="auto">public slots:<br />
void ledOn();<br />
void ledOff();<br />
void keyPressed();<br />
void keyReleased();</p>
<p dir="auto">private:<br />
KeyboardStateMachine <em>m_machine;<br />
QHash&lt;QString,  QObject</em>&gt; m_keys;<br />
};</p>
<p dir="auto">#endif // KEYBOARD_H</p>
<p dir="auto">2: I'm using qt5.7.0 on ubuntu with qtcreator. My .pro file looks like this:</p>
<p dir="auto">QT += qml quick scxml<br />
CONFIG += c++11<br />
SOURCES += main.cpp <br />
keyboard.cpp<br />
STATECHARTS = statemachine.scxml<br />
load(qscxmlc)<br />
RESOURCES += qml.qrc<br />
QML_IMPORT_PATH =<br />
include(deployment.pri)<br />
HEADERS += <br />
keyboard.h</p>
<p dir="auto">It's interesting the statmachine.h gets only created if I run the compile from commandline. How can I tell qtcreator to run the compile of the statemachine so it finds the .h file - but that's  a different issue.</p>
<p dir="auto">But to answer the question the statemachine.h file create when calling qscxmlc statemachine.scxml does not contain the signals -<br />
qscxmlc --version is: qscxmlc 1 (Qt 5.7.0)</p>
]]></description><link>https://forum.qt.io/post/343992</link><guid isPermaLink="true">https://forum.qt.io/post/343992</guid><dc:creator><![CDATA[larry104]]></dc:creator><pubDate>Wed, 24 Aug 2016 18:59:02 GMT</pubDate></item><item><title><![CDATA[Reply to qtscxml: connect to signals on Wed, 24 Aug 2016 10:27:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/larry104">@<bdi>larry104</bdi></a> said:<br />
Hi<br />
The normal cause for this error is<br />
1: forgot<br />
Q_OBJECT macro in a QObject subclass ( your KeyboardStateMachine)</p>
<p dir="auto">2:<br />
Using visual studio and qmake/moc.exe is not run.</p>
<p dir="auto">Update:<br />
Did you check the files generated by<br />
qscxmlc<br />
that they do in fact contain such signals?</p>
]]></description><link>https://forum.qt.io/post/343899</link><guid isPermaLink="true">https://forum.qt.io/post/343899</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 24 Aug 2016 10:27:49 GMT</pubDate></item></channel></rss>