QScxmlEvent Class▲
-
Header: QScxmlEvent
-
Since: Qt 5.7
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Scxml)
target_link_libraries(mytarget PRIVATE Qt6::Scxml)
-
qmake: QT += scxml
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▲
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:
delay : int▲
This property holds the delay in milliseconds after which the event is to be delivered after processing the <send> element.
Access functions:
[read-only] 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:
-
errorMessage() const
-
void setErrorMessage(const &message)
eventType : EventType▲
This property holds the type of the event.
Access functions:
-
eventType() const
-
void setEventType(const &type)
invokeId : QString▲
This property holds the ID of the invoked state machine if the event is generated by one.
Access functions:
-
invokeId() const
-
void setInvokeId(const &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:
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:
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:
-
originType() const
-
void setOriginType(const &origintype)
[read-only] scxmlType : const QString▲
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.
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:
Member Function Documentation▲
QScxmlEvent::QScxmlEvent()▲
Creates a new external SCXML event.
QScxmlEvent::QScxmlEvent(const QScxmlEvent &other)▲
Constructs a copy of other.
QScxmlEvent::~QScxmlEvent()▲
Destroys the SCXML event.
void QScxmlEvent::clear()▲
Clears the contents of the event.
QVariant QScxmlEvent::data() const▲
Returns the data included by the sender.
Getter function for property data.
See Also▲
See also setData()
int QScxmlEvent::delay() const▲
Returns the delay in milliseconds after which this event is to be delivered after processing the <send> element.
Getter function for property delay.
See Also▲
See also setDelay()
QString QScxmlEvent::errorMessage() const▲
If this is an error event, returns the error message. Otherwise, returns an empty QString.
Getter function for property errorMessage.
See Also▲
See also setErrorMessage()
QScxmlEvent::EventType QScxmlEvent::eventType() const▲
Returns the type of this event.
Getter function for property eventType.
See Also▲
See also setEventType(), QScxmlEvent::EventType
QString QScxmlEvent::invokeId() const▲
If this event is generated by an invoked state machine, returns the ID of the <invoke> element. Otherwise, returns an empty value.
Getter function for property invokeId.
See Also▲
See also setInvokeId()
bool QScxmlEvent::isErrorEvent() const▲
Returns true when this is an error event, false otherwise.
Getter function for property errorEvent.
QString QScxmlEvent::name() const▲
QString QScxmlEvent::origin() const▲
Returns a URI that points to the origin of an SCXML event.
Getter function for property origin.
See Also▲
See also setOrigin()
QString QScxmlEvent::originType() const▲
Returns the origin type of an SCXML event.
Getter function for property originType.
See Also▲
See also setOriginType()
QString QScxmlEvent::scxmlType() const▲
Returns the event type.
Getter function for property scxmlType.
QString QScxmlEvent::sendId() const▲
void QScxmlEvent::setData(const QVariant &data)▲
Sets the payload data to data.
Setter function for property data.
See Also▲
See also QScxmlEvent::data
void QScxmlEvent::setDelay(int delayInMiliSecs)▲
Sets the delay in milliseconds as the value of delayInMiliSecs.
Setter function for property delay.
See Also▲
See also QScxmlEvent::delay
void QScxmlEvent::setErrorMessage(const QString &message)▲
If this is an error event, the message is set as the error message.
Setter function for property errorMessage.
See Also▲
See also errorMessage()
void QScxmlEvent::setEventType(const QScxmlEvent::EventType &type)▲
Sets the event type to type.
Setter function for property eventType.
See Also▲
See also QScxmlEvent::eventType, QScxmlEvent::EventType
void QScxmlEvent::setInvokeId(const QString &invokeid)▲
Sets the ID of an invoked state machine to invokeid.
Setter function for property invokeId.
See Also▲
See also QScxmlEvent::invokeId
void QScxmlEvent::setName(const QString &name)▲
void QScxmlEvent::setOrigin(const QString &origin)▲
Sets the origin of an SCXML event to origin.
Setter function for property origin.
See Also▲
See also QScxmlEvent::origin
void QScxmlEvent::setOriginType(const QString &origintype)▲
Sets the origin type of an SCXML event to origintype.
Setter function for property originType.
See Also▲
See also QScxmlEvent::originType
void QScxmlEvent::setSendId(const QString &sendid)▲
QScxmlEvent &QScxmlEvent::operator=(const QScxmlEvent &other)▲
Assigns other to this SCXML event and returns a reference to this SCXML event.