[Qt-interest] eventTest() and parallel states in QStateMachine
noam.rosenthal at nokia.com
noam.rosenthal at nokia.com
Mon Feb 7 23:23:45 CET 2011
On Feb 7, 2011, at 12:43 PM, ext Stephen Kelly wrote:
Daniel Zollinger wrote:
Now I ran into troubles:
If the state machine is in state "Overview" and "MapSelection" gets
triggered, the dialog is shown once, but if the the machine is in state
"Map" the dialog is shown twice.
My first thought was: that's a bug, and I contacted the qt support. It
turned out that It's actually consistent with the SCXML spec, on which
the qt state machine implementation is based on.
Sorry, I missed the original post so I'll reply to this one.
This is indeed copied from the SCXML algorithm, which assumes that eventTest (or the SCXML equivalent of condition+eventName) has no consequences and thus running it more than once is, as well, inconsequential.
I'd offer a patch to the SCXML algorithm:
function selectTransitions(event):
enabledTransitions = new OrderedSet()
atomicStates = configuration.toList().filter(isAtomicState).sort(documentOrder)
for state in atomicStates:
if not isPreempted(state, enabledTransitions):
loop: for s in [state].append(getProperAncestors(state, null)):
for t in s.transition:
+ if !enabledTransitions.contains(t):
if t.event and nameMatch(t.event, event.name<http://event.name>) and conditionMatch(t): enabledTransitions.add(t) break loop return enabledTransitions
Please file a bugreport at bugreports.qt.nokia.com<http://bugreports.qt.nokia.com>
Architecturally, I advise you to put less "beef" inside eventTest and instead give your MapSelect dialog its own state, which would make this problem irrelevant (as the transition would happen only once, even if tested more than once).
No'am
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110207/9c84c798/attachment.html
More information about the Qt-interest-old
mailing list