[Interest] Qt QML 5.4 State Machine - external js from 'guard' can't be called directly

Petar Koretić petar.koretic at gmail.com
Fri Dec 19 13:45:20 CET 2014

Hi all.

I'm testing new State Machine from Qt 5.4.

I've created smallest possible code to reproduce the problem that I've hit:


Calling Core.call_me() which is defined in external javascript file from
'guard' javascript section doesn't work. Calling it by using some other
function as a proxy works. Calling external javascript function from other
properties like 'onTriggered' also works. So in my testing it doesn't work
only in when custom external function is first called from guard.

And if first we call function 'i_work_if_called' and then
Core.core.call_me() then they both get called.

So I'm probably missing something and probably that's not supposed to work
but it makes problem since it works in some casses and not in others.
Any insight?

There probably isn't any reason to execute some external code from guard
section and I guess it should be avoided since it gets called for each
But I wanted to handle few keys triggering same state without writing
separate SignalTransition for each key and then executing javascript from
'onTriggered' event which is how I have it now but it's a lot more code.

And if I just say 'key == Qt.Key_up || key == Qt.Key_Down'  I don't know
how to later know which of the keys sent the signal.

Any information is appreciated and I would really love for some pointers on
how to actually use it properly. Not many examples exist yet (I haven't
seen in the docs how to properly handle keys so I may be way off) and I
guess not that many people use this yet.

Thanks for reading.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141219/d8b737a7/attachment.html>

More information about the Interest mailing list