summaryrefslogtreecommitdiffstats
path: root/examples/mediaplayer/spmodel.cpp
diff options
context:
space:
mode:
authorMarc Schmitzer <marc.schmitzer@richard-wolf.com>2012-01-27 16:28:18 +0100
committerMarc Schmitzer <marc.schmitzer@richard-wolf.com>2012-01-27 16:28:18 +0100
commit9be5070e56f170a239dcc075f9dc5b21a1ea8a4d (patch)
treecc05f23c5c6b1a6d4989a64d5a292d40060ea432 /examples/mediaplayer/spmodel.cpp
parenteb07b340d03fd5749205490c766020b59d740e98 (diff)
Change parsing of "event" attribute of transitions.HEADmaster
Previously, the event prefixes for a transition where obtained by using QString::split(' ') on the value of the "event" attribute. QString::split() also retains empty strings resulting from the split, which has two consequences: 1) If the event attribute is empty or missing, a QStringList containing a single empty string is returned. This makes event-less transitions work, which are executed immediately (if the condition is met). 2) If the event attribute contains multiple prefixes separated by more than one space character, the returned list contains the prefixes *and* one or more empty strings. This makes the transition trigger immediately and on *any* event. Since an extra space is an easy mistake to make and difficult to spot (speaking from experience), this behaviour is rather undesirable. To fix this, this patch changes the parsing of the event attribute to use QString::split(' ', QString::SkipEmptyParts). This fixes (2) but breaks (1). To keep event-less transitions working, QScxmlTransition::eventTest() is changed to match events of type QEvent::None if the transition has no event prefixes. Due to the above change, this is the case when the "event" attribute is ommitted or contains only space characters. NOTE: Strictly speaking, this removes a feature from qscxml. In the previous state, it was possible to create a transition (presumably with a guard condition) that is both executed immediately when its source state is entered *and* triggered by one or more signals. With this change, a transition can only be either immediate or triggered by (an) event(s), not both. The W3C scxml specification seems to specify this behaviour (see http://www.w3.org/TR/scxml/#SelectingTransitions ).
Diffstat (limited to 'examples/mediaplayer/spmodel.cpp')
0 files changed, 0 insertions, 0 deletions