[Interest] SCXML and datamodel sharing in Qt Quick and C++

Tomasz Olszak olszak.tomasz at gmail.com
Fri Dec 1 11:03:36 CET 2017


Hi,

For some time I play with Qt SCXML. I will explain current approach and
please help me if I do something in wrong way.

1. I use scxml compiler and expose compiled machine to Qt Quick.
2. I use ecmascript as datamodel type. I create data entries in *.scxml
file.
3. I need to repeat those values on Qt Quick side and assign to
StateMachine.initialValues so that they will be reset everytime machine
starts - without it even when default values for data entries in scxml file
are set - they are not reset.
4. To change model entries (and the same evaluate transition conditions
that have those entries in cond attribute) I need to send custom, external
event from Qt Quick (let's call it DATAMODEL.CHANGE), which contains
dictionary. In scxml I handle that event by assigning all entries of that
dictionary to  corresponding datamodel entries.

So I end up defining model in 3 places:
1. scxml file
2. in Qt Quick in initialValues - to set default values for data entries
from scxml everytime state machine starts
3. in Qt Quick special JS object (dict) to make possible to update data
values on scxml side by handling custom event.

I don't think I need to explain why it is so bad. Is it possible by any way
to define model once and share it between scxml state machine, Qt Quick,
C++ side?


Thanks in advance,
Tomek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171201/85f57565/attachment.html>


More information about the Interest mailing list