diff options
Diffstat (limited to 'src/qscxml.cpp')
-rw-r--r-- | src/qscxml.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qscxml.cpp b/src/qscxml.cpp index c44e135..a9896c3 100644 --- a/src/qscxml.cpp +++ b/src/qscxml.cpp @@ -618,10 +618,15 @@ bool QScxmlTransition::eventTest(QEvent *e) QString event; if (e) { - if (e->type() == QScxmlEvent::eventType()) { + bool found = false; + if (e->type() == QEvent::None) { + // QEvent::None events are posted when a state is entered. + // If we have no event prefixes we are triggered by those events. + found = ev.isEmpty(); + } + else if (e->type() == QScxmlEvent::eventType()) { event = ((QScxmlEvent*)e)->eventName(); } - bool found = false; for (int i=0; i < ev.size() && !found; ++i) { QString prefix = ev[i]; found = prefix=="*" || prefix==event || event.startsWith(prefix) @@ -1420,7 +1425,7 @@ void QScxmlLoader::loadState ( curExecContext.script = ""; curTransition = new QScxmlTransition(curState,stateMachine); curTransition->setConditionExpression(r.attributes().value("cond").toString()); - curTransition->setEventPrefixes(r.attributes().value("event").toString().split(' ')); + curTransition->setEventPrefixes(r.attributes().value("event").toString().split(' ', QString::SkipEmptyParts)); foreach(QString pfx, curTransition->eventPrefixes()) { if (pfx != "*") stateMachine->pvt->knownEvents.insert(pfx); |