Unsolved How to use scc and scxml with a qmake-based project?
-
I've been looking into Qt's support for scxml and I'm very interested in generating state machines from state charts. However, I haven't had any success getting Qt Creator to generate any code from scxml definitions. So far I've added a scxml document to a qmake project under the
STATECHARTS
variable, created a basic state machine diagram and ran build, but I'm yet to get the build process to generate any code. Does anyone know if this feature is still supported by Qt Creator? If it is, what steps should be taken to get a qmake-based project to generate C++ code for state machines defined in scxml documents? -
@rmam Did you check this: https://doc.qt.io/qt-5.10/qtscxml-index.html
-
@jsulm Yes, and I've followed the SCXML calculator example. Thus, I've added Qt's SCXML module to the project and a scxml document to the
STATECHARTS
diagram. The example states that after adding the module and the scxml file, qscxmlc would be run automatically to generate the source files. Yet, after running the build process I see no new source files. -
@rmam You should delete the build folder, run qmake and then build after changing pro file
-
@jsulm thanks for the help. I've followed your tips and ran a test with a Qt 5.10 build and it seems that everything worked well. Kudos.
I've also tried with an old Qt 5.3 project but that project threw an error ("Unknown module(s) in QT: scxml"). I've browsed through the docs but haven't found any information on which Qt version was required to be able to integrate SCXML-based stuff in a project. Does anyone know in which release was the support for SCXML introduced?
-
@rmam said in How to use scc and scxml with a qmake-based project?:
@jsulm thanks for the help. I've followed your tips and ran a test with a Qt 5.10 build and it seems that everything worked well. Kudos.
I've also tried with an old Qt 5.3 project but that project threw an error ("Unknown module(s) in QT: scxml"). I've browsed through the docs but haven't found any information on which Qt version was required to be able to integrate SCXML-based stuff in a project. Does anyone know in which release was the support for SCXML introduced?
It was added in Qt 5.8: https://wiki.qt.io/New_Features_in_Qt_5.8
-
@rmam You can find the version information if you open the documentation for one of the classes, like https://doc.qt.io/qt-5.10/qscxmlcompiler-loader.html
-
@jsulm that that doc page refers to a specific class (
QScxmlCompiler::Loader
) which apparently was added subsequently to a class introduced in a earlier release (QScxmlCompiler
, introduced in Qt 5.7).Evenso, apparently those classes cover another feature which is only orthogonaly related with generating source code from SCXML documents.
Meanwhile, the Qt Creator's manual entry on Editing State Charts does not mention anywhere which Qt version is required to use this feature. This may cause some confusion as potential users may be led to believe that this feature just works, although it doesn't.