Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

SCXML and javascript and asynchronouse action



  • Hello,

    I plan to write an application that based on QML/SCXML. My idea was to create the flow in scxml and the events will trigger my UI transitions (and button pressing triggers the scxml). I would like to create a login service (as demonstration).
    So I created a new Item with minimal content (only a ListView and a BusyIndicator). I created the scxml state machine, after I created the gui Item states and I connected the states of Item and StateMachine. The state machine started and could write log (<log> tag). But I faced problem and questions here:

    • how can I call JS functions from scxml script block (I write what I tried to do, but that didn't worked)?
    • how can I post an event to StateMachine from a JS function?
    • can I reach my gui Item's ListView's model, or I can access only the model of the statechart (like is it in sudoku example)?

    I tried to add my JS file to scxml diagram and after I tried to call the JS function, but that failed. (the log action before the script call runs, but log action after JS call doesn't, and JS function console.log also doesn't write anything).

    You can see the example project on: https://bitbucket.org/tatraian/forum_example/src/default

    Thanks:
    Antal Tatrai


Log in to reply