<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qscxmlc.qdoc --> <title>Using the Qt SCXML Compiler (qscxmlc) | Qt SCXML 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtscxml-index.html">Qt SCXML</a></td><td >Using the Qt SCXML Compiler (qscxmlc)</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#usage">Usage</a></li> <li class="level1"><a href="#command-line-options">Command-Line Options</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Using the Qt SCXML Compiler (qscxmlc)</h1> <span class="subtitle"></span> <!-- $$$qscxmlc.html-description --> <div class="descr"> <a name="details"></a> <p>The <code>qscxmlc</code> tool reads an .scxml file and produces C++ source and header files, containing a class that implements a state machine as defined in SCXML.</p> <a name="usage"></a> <h2 id="usage">Usage</h2> <p>The <code>qscxml</code> tool is invoked automatically if the QT variable in the project file includes <code>scxml</code>, and the .scxml file to use is specified using the <code>STATECHARTS</code> variable.</p> <pre class="cpp plain"> QT += scxml STATECHARTS = MyStatemachine.scxml </pre> <p>With above definitions, <code>qmake</code> invokes <code>qscxmlc</code> to generate MyStatemachine.h and MyStatemachine.cpp, and adds them to HEADERS and SOURCES variables.</p> <p>By default, the name of the generated class that implements the state machine corresponds with the <i>name</i> attribute of the <code><scxml></code> root element.</p> <a name="command-line-options"></a> <h2 id="command-line-options">Command-Line Options</h2> <p>The <code>qscxmlc</code> tool supports the following command-line options, which can be specified using the <code>QSCXMLC_ARGUMENTS</code> variable in the project file:</p> <div class="table"><table class="generic"> <thead><tr class="qt-style"><th >Option</th><th >Description</th></tr></thead> <tr valign="top" class="odd"><td ><code>--namespace <namespace></code></td><td >Put the generated class(es) in the specified namespace. You can use the <code>QSCXMLC_NAMESPACE</code> variable to specify this in your project file.</td></tr> <tr valign="top" class="even"><td ><code>-o <base/out/name></code></td><td >The base name of the output files. This can include a path. If none is specified, the basename of the input file is used.</td></tr> <tr valign="top" class="odd"><td ><code>--header <header/out></code></td><td >The name of the output header file. If none is specified, .h is added to the base name.</td></tr> <tr valign="top" class="even"><td ><code>--impl <cpp/out></code></td><td >The name of the output header file. If none is specified, .cpp is added to the base name.</td></tr> <tr valign="top" class="odd"><td ><code>--classname <StateMachineClassName></code></td><td >The class name of the generated state machine. If none is specified, the value of the name attribute of the <scxml> tag is taken. If that attribute is not specified either, the basename (excluding path) is taken from the input file name.</td></tr> <tr valign="top" class="even"><td ><code>--statemethods</code></td><td >Generate extra accessor and signal methods for states. This way you can connect to state changes with plain QObject::connect() and directly call a method to find out if a state is currently active.</td></tr> </table></div> </div> <!-- @@@qscxmlc.html --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>