QScxmlStateMachine Class
The QScxmlStateMachine class provides an interface to the state machines created from SCXML files. More...
| Header: | #include <QScxmlStateMachine> |
| qmake: | QT += scxml |
| Since: | Qt 5.7 |
| Instantiated By: | ScxmlStateMachine |
| Inherits: | QObject |
This class was introduced in Qt 5.7.
Properties
|
|
Public Functions
| QScxmlDataModel * | dataModel() const |
| QVariantMap | initialValues() |
| QVector<QScxmlInvokableService *> | invokedServices() const |
| bool | isInitialized() const |
| bool | isInvoked() const |
| bool | isRunning() const |
| QScxmlCompiler::Loader * | loader() const |
| QString | name() const |
| QVector<QScxmlError> | parseErrors() const |
| QString | sessionId() const |
| void | setDataModel(QScxmlDataModel *model) |
| void | setInitialValues(const QVariantMap &initialValues) |
| void | setLoader(QScxmlCompiler::Loader *loader) |
| void | setRunning(bool running) |
| void | setTableData(QScxmlTableData *tableData) |
| QScxmlTableData * | tableData() const |
Signals
| void | dataModelChanged(QScxmlDataModel *model) |
| void | initialValuesChanged(const QVariantMap &initialValues) |
| void | initializedChanged(bool initialized) |
| void | invokedServicesChanged(const QVector<QScxmlInvokableService *> &invokedServices) |
| void | loaderChanged(QScxmlCompiler::Loader *loader) |
| void | runningChanged(bool running) |
| void | tableDataChanged(QScxmlTableData *tableData) |
Detailed Description
QScxmlStateMachine is an implementation of the State Chart XML (SCXML).
All states that are defined in the SCXML file are accessible as properties of QScxmlStateMachine. These properties are boolean values and indicate whether the state is active or inactive.
Note: The QScxmlStateMachine needs a QEventLoop to work correctly. The event loop is used to implement the delay attribute for events and to schedule the processing of a state machine when events are received from nested (or parent) state machines.
Property Documentation
dataModel : QScxmlDataModel*
This property holds the data model to be used for this state machine.
SCXML data models are described in SCXML Specification - 5 Data Model and Data Manipulation. For more information about supported data models, see SCXML Compliance.
Changing the data model when the state machine has been initialized is not specified in the SCXML standard and leads to undefined behavior.
Access functions:
| QScxmlDataModel * | dataModel() const |
| void | setDataModel(QScxmlDataModel *model) |
Notifier signal:
| void | dataModelChanged(QScxmlDataModel *model) |
See also QScxmlDataModel, QScxmlNullDataModel, QScxmlEcmaScriptDataModel, and QScxmlCppDataModel.
initialValues : QVariantMap
This property holds the initial values to be used for setting up the data model.
Access functions:
| QVariantMap | initialValues() |
| void | setInitialValues(const QVariantMap &initialValues) |
Notifier signal:
| void | initialValuesChanged(const QVariantMap &initialValues) |
See also QScxmlStateMachine::init() and QScxmlDataModel.
initialized : const bool
This property holds whether the state machine has been initialized.
It is true if the state machine has been initialized, false otherwise.
Access functions:
| bool | isInitialized() const |
Notifier signal:
| void | initializedChanged(bool initialized) |
See also QScxmlStateMachine::init() and QScxmlDataModel.
invoked : const bool
This property holds whether the state machine was invoked from an outer state machine.
true when the state machine was started as a service with the <invoke> element, false otherwise.
Access functions:
| bool | isInvoked() const |
invokedServices : QVector<QScxmlInvokableService*> const
This property holds a list of SCXML services that were invoked from the main state machine (possibly recursively).
Access functions:
| QVector<QScxmlInvokableService *> | invokedServices() const |
Notifier signal:
| void | invokedServicesChanged(const QVector<QScxmlInvokableService *> &invokedServices) |
loader : QScxmlCompiler::Loader*
This property holds the loader that is currently used to resolve and load URIs for the state machine.
Access functions:
| QScxmlCompiler::Loader * | loader() const |
| void | setLoader(QScxmlCompiler::Loader *loader) |
Notifier signal:
| void | loaderChanged(QScxmlCompiler::Loader *loader) |
name : const QString
This property holds the name of the state machine as set by the name attribute of the <scxml> tag.
Access functions:
| QString | name() const |
parseErrors : const QVector<QScxmlError>
This property holds the list of parse errors that occurred while creating a state machine from an SCXML file.
Access functions:
| QVector<QScxmlError> | parseErrors() const |
running : bool
This property holds the running state of this state machine
Access functions:
| bool | isRunning() const |
| void | setRunning(bool running) |
Notifier signal:
| void | runningChanged(bool running) |
See also start().
sessionId : const QString
This property holds the session ID of the current state machine.
The session ID is used for message routing between parent and child state machines. If a state machine is started by an <invoke> element, any event it sends will have the invokeid field set to the session ID. The state machine will use the origin of an event (which is set by the target or targetexpr attribute in a <send> element) to dispatch messages to the correct child state machine.
Access functions:
| QString | sessionId() const |
See also QScxmlEvent::invokeId().
tableData : QScxmlTableData*
This property holds the table data that is used when generating C++ from an SCXML file.
The class implementing the state machine will use this property to assign the generated table data. The state machine does not assume ownership of the table data.
Access functions:
| QScxmlTableData * | tableData() const |
| void | setTableData(QScxmlTableData *tableData) |
Notifier signal:
| void | tableDataChanged(QScxmlTableData *tableData) |