summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@theqtcompany.com>2016-02-10 09:56:29 +0100
committerJarek Kobus <jaroslaw.kobus@theqtcompany.com>2016-04-12 19:09:52 +0000
commite1513d7f904f03617c38f14d65cdaa8afd4ff2b2 (patch)
tree0af97ecae076945fdcf18b44d025a04a7d6a747f /src
parentfcd9af589dbf5bc9dcf100c7fa8ebdfed7d88243 (diff)
Add externalEventOccurred() signal.v5.7.0-beta1
This signal is emitted only for events sent from SCXML file which are of qt:signal type. Reasoning: I want to use state names which contain dots, e.g. "Letter.A", "Letter.B", etc. The reason for that is I may listen to "done.state.Letter.*" event, which will be generated automatically whenever one of Letter.* went to its final state. Unfortunately, I cannot use qt-mode in that case, since dots in state names are not allowed in qt-mode. I'm forced to use non-qt-mode. In the same document I send external signals with <send type="qt:signal">. In order to listen to these signals I need to connect to the generic eventOccurred() signal in cpp code, since there is no other way in non-qt-mode. However, when I'm connected to eventOccurred() my slot is being invoked for every internal event, which slows down the execution. Practically, I'm not interested in internal events at all, but only for those marked with type="qt:signal". That's why this patch provides additional generic signal for "qt:signal" only event. Change-Id: Ic9206e98a20f72142f5584e0568f9f33d56f8e97 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/scxml/qscxmlstatemachine.cpp4
-rw-r--r--src/scxml/qscxmlstatemachine.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/scxml/qscxmlstatemachine.cpp b/src/scxml/qscxmlstatemachine.cpp
index 78a8542..3ef07ae 100644
--- a/src/scxml/qscxmlstatemachine.cpp
+++ b/src/scxml/qscxmlstatemachine.cpp
@@ -667,6 +667,10 @@ void QScxmlInternal::WrappedQStateMachine::beginSelectTransitions(QEvent *event)
emit d->stateMachine()->eventOccurred(*scxmlEvent);
}
+ if (scxmlEvent->originType() == QLatin1String("qt:signal")) {
+ emit d->stateMachine()->externalEventOccurred(*scxmlEvent);
+ }
+
if (smp->m_eventFilter && !smp->m_eventFilter->handle(scxmlEvent, d->stateMachine())) {
scxmlEvent->makeIgnorable();
scxmlEvent->clear();
diff --git a/src/scxml/qscxmlstatemachine.h b/src/scxml/qscxmlstatemachine.h
index 0037fef..5a800d5 100644
--- a/src/scxml/qscxmlstatemachine.h
+++ b/src/scxml/qscxmlstatemachine.h
@@ -141,6 +141,7 @@ Q_SIGNALS:
void dataModelChanged(QScxmlDataModel *model);
void initialValuesChanged(const QVariantMap &initialValues);
void initializedChanged(bool initialized);
+ void externalEventOccurred(const QScxmlEvent &event);
public Q_SLOTS:
void start();