Important: Please read the Qt Code of Conduct -

QStateMachine and SCXML

  • Hello,

    I was using the State Machine Framework for my applications using QtStateMachine and QtState classes.
    Recently, I read some stuffs about SCXML and the possibility to do state machines using QtScriptedStateMachine.

    Then, I tried this in my applications:
    // Load the SCXML file
    mStateMachine = QtScriptedStateMachine::load(_pathToScxmlFile);

    // register some objects
    mStateMachine->registerObject(mMyObject, "object1", true);

    I load my scxml file using the QtScriptedStateMachine and register some objects and then I start the state machine.
    I use an editor to generate the scxml file (fsm-editor on and it seems to work properly (I've checked the scxml file).

    As soon as I want to add a transition in my state machine using the editor, it's not working anymore. The only think it does is to add one single line <transition event="..." target="..."> ... </transition>. The transition is working but then the state machine is blocked later in another state where no changes were done and everything was working before this modification.

    After a lot of tests and tries, I had the feeling that I was doing something wrong with the QtScriptedStateMachine.
    I wanted to try Qt 4.7.2 (I was using Qt 4.5.3 and the state machine framework 1.1) but I don't find any scripted state machine class anymore in this new release.

    Has something new been done in this field? Am I doing something wrong? Is there another way to use SCXML files?

    Thank you so much for helping,
    S. Amsellem

  • bq. I was using Qt 4.5.3

    According to this:

    bq. Thiago Macieira August 15, 2009 at 11:10 am
    The state machine code is in Qt 4.6

    So I would definitely try something newer than 4.5.3

  • Did QtScriptedStateMachine make it to Qt 4.7. I cannot find it in the QtCreator help

  • [quote author="sriky27" date="1305543073"]Did QtScriptedStateMachine make it to Qt 4.7. I cannot find it in the QtCreator help[/quote]

    It's still a separate project; see
    Since Qt is moving to being more modularized it will probably stay that way but would hopefully stay helpful.

Log in to reply