SCXML Statemachine donedata event



  • Hallo,

    I am exprimenting with the new QScxmlStateMachine. Currently I am running a state machine with JavaScript data model and I am wondering how to catch the donedata event.

    For example my statemachine defines the following final state:

    <final id="finished">
        <donedata>
            <param name="DoneValue" expr="1" />
        </donedata>
    </final>
    

    According to the SCXML spec (section 3.7.2)

    When the state machine enters the <final> child of a <state> element, the SCXML Processor must generate the event done.state.id after completion of the <onentry> elements, where id is the id of the parent state.

    an event should be send when the final state is reached. My question now is, how can I catch the event on C++/QML side. I have alread tried a generice event handler like as shown below but now done event occurred.

    Connections {
        target: stateMachine
        onEventOccurred: {
            console.log(event.name)
        }
    }
    

    May someone could give me a hint.

    Many thanks in advance!

    Wolf Bublitz


  • Qt Champions 2016

    Hi,
    This is a user forum and it's somewhat unlikely you'd get a good answer here, because your question relates to a technical preview module.
    I suggest you ask on the mailing list where you might find the actual developers of the module.

    Kind regards.



  • Why don't you just send a signal

    <final id="finished">
        <onentry>
           <send type="qt:signal" event="done"/>
       </onentry>
    </final>
    

    don't forget to turn on the qt mode to receive signals on the c++ side

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- enable-qt-mode: yes -->
    <scxml ....
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.