QScxmlEvent Class
The QScxmlEvent class is an event for a Qt SCXML state machine. More...
| Header: | #include <QScxmlEvent> |
| qmake: | QT += scxml |
| Since: | Qt 5.7 |
This class was introduced in Qt 5.7.
Public Types
| enum | EventType { PlatformEvent, InternalEvent, ExternalEvent } |
Properties
|
|
Public Functions
| QVariant | data() const |
| int | delay() const |
| QString | errorMessage() const |
| QScxmlEvent::EventType | eventType() const |
| QString | invokeId() const |
| bool | isErrorEvent() const |
| QString | name() const |
| QString | origin() const |
| QString | originType() const |
| QString | scxmlType() const |
| QString | sendId() const |
| void | setData(const QVariant &data) |
| void | setDelay(int delayInMiliSecs) |
| void | setErrorMessage(const QString &message) |
| void | setEventType(const QScxmlEvent::EventType &type) |
| void | setInvokeId(const QString &invokeId) |
| void | setName(const QString &name) |
| void | setOrigin(const QString &origin) |
| void | setOriginType(const QString &originType) |
| void | setSendId(const QString &sendId) |
Detailed Description
SCXML events drive transitions. Most events are generated by using the <raise> and <send> elements in the application. The state machine automatically generates some mandatory events, such as errors.
For more information, see SCXML Specification - 5.10.1 The Internal Structure of Events. For more information about how the Qt SCXML API differs from the specification, see SCXML Compliance.
See also QScxmlStateMachine.
Member Type Documentation
enum QScxmlEvent::EventType
This enum type specifies the type of an SCXML event:
| Constant | Value | Description |
|---|---|---|
QScxmlEvent::PlatformEvent | 0 | An event generated internally by the state machine. For example, errors. |
QScxmlEvent::InternalEvent | 1 | An event generated by a <raise> element. |
QScxmlEvent::ExternalEvent | 2 | An event generated by a <send> element. |
Property Documentation
data : QVariant
This property holds the data included by the sender.
When <param> elements are used in the <send> element, the data will contain a QVariantMap where the key is the name attribute, and the value is taken from the expr attribute or the location attribute.
When a <content> element is used, the data will contain a single item with either the value of the expr attribute of the <content> element or the child data of the <content> element.
Access functions:
| QVariant | data() const |
| void | setData(const QVariant &data) |
delay : int
This property holds the delay in milliseconds after which the event is to be delivered after processing the <send> element.
Access functions:
| int | delay() const |
| void | setDelay(int delayInMiliSecs) |
errorEvent : const bool
This property holds whether the event represents an error.
Access functions:
| bool | isErrorEvent() const |
errorMessage : QString
This property holds an error message for an error event, or an empty QString.
Access functions:
| QString | errorMessage() const |
| void | setErrorMessage(const QString &message) |
eventType : EventType
This property holds the type of the event.
Access functions:
| QScxmlEvent::EventType | eventType() const |
| void | setEventType(const QScxmlEvent::EventType &type) |
invokeId : QString
This property holds the ID of the invoked state machine if the event is generated by one.
Access functions:
| QString | invokeId() const |
| void | setInvokeId(const QString &invokeId) |
name : QString
This property holds the name of the event.
If the event is generated inside the SCXML document, this property holds the value of the event attribute specified inside the <raise> or <send> element.
If the event is created in the C++ code and submitted to the QScxmlStateMachine, the value of this property is matched against the value of the event attribute specified inside the <transition> element in the SCXML document.
Access functions:
| QString | name() const |
| void | setName(const QString &name) |
origin : QString
This property holds the URI that points to the origin of an SCXML event.
The origin is equivalent to the target attribute of the <send> element.
Access functions:
| QString | origin() const |
| void | setOrigin(const QString &origin) |
originType : QString
This property holds the origin type of an SCXML event.
The origin type is equivalent to the type attribute of the <send> element.
Access functions:
| QString | originType() const |
| void | setOriginType(const QString &originType) |
scxmlType : const QString
This property holds the event type.
Access functions:
| QString | scxmlType() const |
sendId : QString
This property holds the ID of the event.
The ID is used by the <cancel> element to identify the event to be canceled.
Note: The state machine generates a unique ID if the id attribute is not specified in the <send> element. The generated ID can be accessed through this property.
Access functions:
| QString | sendId() const |
| void | setSendId(const QString &sendId) |