QScxmlDataModel Class

The QScxmlDataModel class is the data model base class for a Qt SCXML state machine. 更多...

头: #include <QScxmlDataModel>
CMake: find_package(Qt6 REQUIRED COMPONENTS Scxml)
target_link_libraries(mytarget PRIVATE Qt6::Scxml)
qmake: QT += scxml
继承: QObject
继承者: QScxmlCppDataModel and QScxmlNullDataModel

公共类型

class ForeachLoopBody

特性

公共函数

QScxmlDataModel (QObject * parent = nullptr)
QBindable<QScxmlStateMachine *> bindableStateMachine ()
virtual void evaluateAssignment (QScxmlExecutableContent::EvaluatorId id , bool * ok ) = 0
virtual void evaluateForeach (QScxmlExecutableContent::EvaluatorId id , bool * ok , QScxmlDataModel::ForeachLoopBody * body ) = 0
virtual void evaluateInitialization (QScxmlExecutableContent::EvaluatorId id , bool * ok ) = 0
virtual bool evaluateToBool (QScxmlExecutableContent::EvaluatorId id , bool * ok ) = 0
virtual QString evaluateToString (QScxmlExecutableContent::EvaluatorId id , bool * ok ) = 0
virtual QVariant evaluateToVariant (QScxmlExecutableContent::EvaluatorId id , bool * ok ) = 0
virtual void evaluateToVoid (QScxmlExecutableContent::EvaluatorId id , bool * ok ) = 0
virtual bool hasScxmlProperty (const QString & name ) const = 0
virtual QVariant scxmlProperty (const QString & name ) const = 0
virtual void setScxmlEvent (const QScxmlEvent & event ) = 0
virtual bool setScxmlProperty (const QString & name , const QVariant & value , const QString & context ) = 0
void setStateMachine (QScxmlStateMachine * stateMachine )
virtual bool setup (const QVariantMap & initialDataValues ) = 0
QScxmlStateMachine * stateMachine () const

信号

void stateMachineChanged (QScxmlStateMachine * stateMachine )

静态公共成员

QScxmlDataModel * createScxmlDataModel (const QString & pluginKey )

保护函数

QScxmlDataModel (QScxmlDataModelPrivate & dd , QObject * parent = nullptr)

详细描述

SCXML data models are described in SCXML Specification - 5 Data Model and Data Manipulation . For more information about supported data models, see SCXML 合规 .

One data model can only belong to one state machine.

另请参阅 QScxmlStateMachine , QScxmlCppDataModel ,和 QScxmlNullDataModel .

特性文档编制

[bindable] stateMachine : QScxmlStateMachine *

注意: 此特性支持 QProperty 绑定。

This property holds the state machine this data model belongs to.

A data model can only belong to a single state machine and a state machine can only have one data model. This relation needs to be set up before the state machine is started. Setting this property on a data model will automatically set the corresponding dataModel property on the stateMachine .

成员函数文档编制

[explicit] QScxmlDataModel:: QScxmlDataModel ( QObject * parent = nullptr)

Creates a new data model, with the parent object parent .

[explicit protected] QScxmlDataModel:: QScxmlDataModel ( QScxmlDataModelPrivate & dd , QObject * parent = nullptr)

Creates a new data model from the private object dd , with the parent object parent .

[static] QScxmlDataModel *QScxmlDataModel:: createScxmlDataModel (const QString & pluginKey )

Creates a data model from a plugin specified by a pluginKey .

[pure virtual] void QScxmlDataModel:: evaluateAssignment ( QScxmlExecutableContent::EvaluatorId id , bool * ok )

Evaluates the assignment pointed to by id 并设置 ok to false if there was an error or to true if there was not.

[pure virtual] void QScxmlDataModel:: evaluateForeach ( QScxmlExecutableContent::EvaluatorId id , bool * ok , QScxmlDataModel::ForeachLoopBody * body )

Evaluates the foreach loop pointed to by id 并设置 ok to false if there was an error or to true if there was not. The body is executed on each iteration.

[pure virtual] void QScxmlDataModel:: evaluateInitialization ( QScxmlExecutableContent::EvaluatorId id , bool * ok )

Evaluates the initialization pointed to by id 并设置 ok to false if there was an error or to true if there was not.

[pure virtual] bool QScxmlDataModel:: evaluateToBool ( QScxmlExecutableContent::EvaluatorId id , bool * ok )

Evaluates the executable content pointed to by id 并设置 ok to false if there was an error or to true if there was not. Returns the result of the evaluation as a boolean value.

[pure virtual] QString QScxmlDataModel:: evaluateToString ( QScxmlExecutableContent::EvaluatorId id , bool * ok )

Evaluates the executable content pointed to by id 并设置 ok to false if there was an error or to true if there was not. Returns the result of the evaluation as a QString .

[pure virtual] QVariant QScxmlDataModel:: evaluateToVariant ( QScxmlExecutableContent::EvaluatorId id , bool * ok )

Evaluates the executable content pointed to by id 并设置 ok to false if there was an error or to true if there was not. Returns the result of the evaluation as a QVariant .

[pure virtual] void QScxmlDataModel:: evaluateToVoid ( QScxmlExecutableContent::EvaluatorId id , bool * ok )

Evaluates the executable content pointed to by id 并设置 ok to false if there was an error or to true if there was not. The execution is expected to return no result.

[pure virtual] bool QScxmlDataModel:: hasScxmlProperty (const QString & name ) const

返回 true if a property with the given name exists, false 否则。

[pure virtual] QVariant QScxmlDataModel:: scxmlProperty (const QString & name ) const

Returns the value of the property name .

另请参阅 setScxmlProperty ().

[pure virtual] void QScxmlDataModel:: setScxmlEvent (const QScxmlEvent & event )

设置 event to use in the subsequent executable content execution.

[pure virtual] bool QScxmlDataModel:: setScxmlProperty (const QString & name , const QVariant & value , const QString & context )

Sets a the value value for the property name .

The context is a string that is used in error messages to indicate the location in the SCXML file where the error occurred.

返回 true if successful or false if an error occurred.

另请参阅 scxmlProperty ().

void QScxmlDataModel:: setStateMachine ( QScxmlStateMachine * stateMachine )

Sets the state machine this model belongs to to stateMachine . There is a 1:1 relation between state machines and models. After setting the state machine once you cannot change it anymore. Any further attempts to set the state machine using this method will be ignored.

注意: setter 函数对于特性 stateMachine .

另请参阅 stateMachine ().

[pure virtual invokable] bool QScxmlDataModel:: setup (const QVariantMap & initialDataValues )

Initializes the data model with the initial values specified by initialDataValues .

返回 false if parse errors occur or if any of the initialization steps fail. Returns true 否则。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

QScxmlStateMachine *QScxmlDataModel:: stateMachine () const

Returns the state machine associated with the data model.

注意: Getter function for property stateMachine.

另请参阅 setStateMachine ().