QScxmlEvent Class

The QScxmlEvent class is an event for a Qt SCXML state machine. 更多...

頭: #include <QScxmlEvent>
qmake: QT += scxml
Since: Qt 5.7

公共類型

enum EventType { PlatformEvent, InternalEvent, ExternalEvent }

特性

公共函數

QScxmlEvent ()
QScxmlEvent (const QScxmlEvent & other )
~QScxmlEvent ()
void clear ()
QVariant data () const
int delay () const
QString errorMessage () const
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 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 )
QScxmlEvent & operator= (const QScxmlEvent & other )

詳細描述

The QScxmlEvent class is an event for a Qt SCXML state machine.

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.

更多信息,見 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 閤規 .

另請參閱 QScxmlStateMachine .

成員類型文檔編製

enum QScxmlEvent:: EventType

This enum type specifies the type of an SCXML event:

常量 描述
QScxmlEvent::PlatformEvent 0 An event generated internally by the state machine. For example, errors.
QScxmlEvent::InternalEvent 1 An event generated by a <raise> 元素。
QScxmlEvent::ExternalEvent 2 An event generated by a <send> 元素。

特性文檔編製

data : QVariant

This property holds the data included by the sender.

<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 屬性。

<content> element is used, the data will contain a single item with either the value of the expr 屬性在 <content> element or the child data of the <content> 元素。

訪問函數:

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> 元素。

訪問函數:

int delay () const
void setDelay (int delayInMiliSecs )

errorEvent : const bool

This property holds whether the event represents an error.

訪問函數:

bool isErrorEvent () const

errorMessage : QString

This property holds an error message for an error event, or an empty QString .

訪問函數:

QString errorMessage () const
void setErrorMessage (const QString & message )

eventType : EventType

This property holds the type of the event.

訪問函數:

EventType eventType () const
void setEventType (const EventType & type )

invokeId : QString

This property holds the ID of the invoked state machine if the event is generated by one.

訪問函數:

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> 元素。

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.

訪問函數:

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 屬性在 <send> 元素。

訪問函數:

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 屬性在 <send> 元素。

訪問函數:

QString originType () const
void setOriginType (const QString & origintype )

scxmlType : const QString

This property holds the event type.

訪問函數:

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.

注意: 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.

訪問函數:

QString sendId () const
void setSendId (const QString & sendid )

成員函數文檔編製

QScxmlEvent:: QScxmlEvent ()

Creates a new external SCXML event.

QScxmlEvent:: QScxmlEvent (const QScxmlEvent & other )

構造副本為 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 函數對於特性 data .

另請參閱 setData ().

int QScxmlEvent:: delay () const

Returns the delay in milliseconds after which this event is to be delivered after processing the <send> 元素。

注意: getter 函數對於特性 delay .

另請參閱 setDelay ().

QString QScxmlEvent:: errorMessage () const

If this is an error event, returns the error message. Otherwise, returns an empty QString .

注意: getter 函數對於特性 errorMessage .

另請參閱 setErrorMessage ().

EventType QScxmlEvent:: eventType () const

Returns the type of this event.

注意: getter 函數對於特性 eventType .

另請參閱 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 函數對於特性 invokeId .

另請參閱 setInvokeId ().

bool QScxmlEvent:: isErrorEvent () const

返迴 true when this is an error event, false 否則。

注意: getter 函數對於特性 errorEvent .

QString QScxmlEvent:: name () const

Returns the name of the event.

注意: getter 函數對於特性 name .

另請參閱 setName ().

QString QScxmlEvent:: origin () const

Returns a URI that points to the origin of an SCXML event.

注意: getter 函數對於特性 origin .

另請參閱 setOrigin ().

QString QScxmlEvent:: originType () const

Returns the origin type of an SCXML event.

注意: getter 函數對於特性 originType .

另請參閱 setOriginType ().

QString QScxmlEvent:: scxmlType () const

返迴事件類型。

注意: getter 函數對於特性 scxmlType .

QString QScxmlEvent:: sendId () const

Returns the ID of the event.

注意: getter 函數對於特性 sendId .

另請參閱 setSendId ().

void QScxmlEvent:: setData (const QVariant & data )

Sets the payload data to data .

注意: setter 函數對於特性 data .

另請參閱 QScxmlEvent::data .

void QScxmlEvent:: setDelay ( int delayInMiliSecs )

Sets the delay in milliseconds as the value of delayInMiliSecs .

注意: setter 函數對於特性 delay .

另請參閱 QScxmlEvent::delay .

void QScxmlEvent:: setErrorMessage (const QString & message )

If this is an error event, the message is set as the error message.

注意: setter 函數對於特性 errorMessage .

另請參閱 errorMessage ().

void QScxmlEvent:: setEventType (const EventType & type )

Sets the event type to type .

注意: setter 函數對於特性 eventType .

另請參閱 QScxmlEvent::eventType and QScxmlEvent::EventType .

void QScxmlEvent:: setInvokeId (const QString & invokeid )

Sets the ID of an invoked state machine to invokeid .

注意: setter 函數對於特性 invokeId .

另請參閱 QScxmlEvent::invokeId .

void QScxmlEvent:: setName (const QString & name )

Sets the name of the event to name .

注意: setter 函數對於特性 name .

另請參閱 name ().

void QScxmlEvent:: setOrigin (const QString & origin )

Sets the origin of an SCXML event to origin .

注意: setter 函數對於特性 origin .

另請參閱 QScxmlEvent::origin .

void QScxmlEvent:: setOriginType (const QString & origintype )

Sets the origin type of an SCXML event to origintype .

注意: setter 函數對於特性 originType .

另請參閱 QScxmlEvent::originType .

void QScxmlEvent:: setSendId (const QString & sendid )

Sets the ID sendid 對於此事件而言。

注意: setter 函數對於特性 sendId .

另請參閱 sendId ().

QScxmlEvent &QScxmlEvent:: operator= (const QScxmlEvent & other )

賦值 other to this SCXML event and returns a reference to this SCXML event.