内容表

上一话题

QScxmlNullDataModel

下一话题

QScxmlStaticScxmlServiceFactory

QScxmlStateMachine

QScxmlStateMachine class provides an interface to the state machines created from SCXML files. 更多

Inheritance diagram of PySide2.QtScxml.QScxmlStateMachine

概要

函数

信号

静态函数

详细描述

QScxmlStateMachine is an implementation of the SCXML (状态图表 XML) .

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.

注意

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.

class QScxmlStateMachine ( metaObject [ , parent=None ] )
参数
  • parent QObject

  • metaObject QMetaObject

PySide2.QtScxml.QScxmlStateMachine. activeStateNames ( [ compress=true ] )
参数

compress bool

返回类型

字符串列表

Retrieves a list of state names of all active states.

When a state is active, all its parent states are active by definition. When compress is true (the default), the parent states will be filtered out and only the leaf states will be returned. When it is false , the full list of active states will be returned.

PySide2.QtScxml.QScxmlStateMachine. cancelDelayedEvent ( sendId )
参数

sendId – unicode

Cancels a delayed event with the specified sendId .

PySide2.QtScxml.QScxmlStateMachine. connectToEvent ( scxmlEventSpec , receiver , 方法 [ , type=Qt.AutoConnection ] )
参数
  • scxmlEventSpec – unicode

  • receiver QObject

  • 方法 – str

  • type ConnectionType

返回类型

Connection

PySide2.QtScxml.QScxmlStateMachine. connectToState ( scxmlStateName , receiver , 方法 [ , type=Qt.AutoConnection ] )
参数
  • scxmlStateName – unicode

  • receiver QObject

  • 方法 – str

  • type ConnectionType

返回类型

Connection

PySide2.QtScxml.QScxmlStateMachine. dataModel ( )
返回类型

QScxmlDataModel

Returns the data model used by the state machine.

另请参阅

setDataModel()

PySide2.QtScxml.QScxmlStateMachine. dataModelChanged ( model )
参数

model QScxmlDataModel

PySide2.QtScxml.QScxmlStateMachine. finished ( )
static PySide2.QtScxml.QScxmlStateMachine. fromData ( data [ , fileName="" ] )
参数
  • data QIODevice

  • fileName – unicode

返回类型

QScxmlStateMachine

Creates a state machine by reading from the QIODevice 指定通过 data .

This method will always return a state machine. If errors occur while reading the SCXML file, fileName , the state machine cannot be started. The errors can be retrieved by calling the parseErrors() 方法。

另请参阅

parseErrors()

static PySide2.QtScxml.QScxmlStateMachine. fromFile ( fileName )
参数

fileName – unicode

返回类型

QScxmlStateMachine

Creates a state machine from the SCXML file specified by fileName .

This method will always return a state machine. If errors occur while reading the SCXML file, the state machine cannot be started. The errors can be retrieved by calling the parseErrors() 方法。

另请参阅

parseErrors()

PySide2.QtScxml.QScxmlStateMachine. init ( )
返回类型

bool

Initializes the state machine.

State machine initialization consists of calling setup() , setting the initial values for <data> elements, and executing any <script> tags of the <scxml> tag. The initial data values are taken from the initialValues 特性。

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

PySide2.QtScxml.QScxmlStateMachine. initialValues ( )
返回类型

PySide2.QtScxml.QScxmlStateMachine. initialValuesChanged ( initialValues )
参数

initialValues

PySide2.QtScxml.QScxmlStateMachine. initializedChanged ( initialized )
参数

initialized bool

PySide2.QtScxml.QScxmlStateMachine. invokedServices ( )
返回类型

PySide2.QtScxml.QScxmlStateMachine. invokedServicesChanged ( invokedServices )
参数

invokedServices

PySide2.QtScxml.QScxmlStateMachine. isActive ( scxmlStateName )
参数

scxmlStateName – unicode

返回类型

bool

PySide2.QtScxml.QScxmlStateMachine. isActive ( stateIndex )
参数

stateIndex int

返回类型

bool

返回 true if the state with the ID stateIndex is active.

This method is part of the interface to the compiled representation of SCXML state machines. It should only be used internally and by state machines compiled from SCXML documents.

PySide2.QtScxml.QScxmlStateMachine. isDispatchableTarget ( target )
参数

target – unicode

返回类型

bool

返回 true if a message to target can be dispatched by this state machine.

Valid targets are:

  • #_parent for the parent state machine if the current state machine is started by <invoke>

  • #_internal for the current state machine

  • #_scxml_sessionid ,其中 sessionid is the session ID of the current state machine

  • #_servicename ,其中 servicename is the ID or name of a service started with <invoke> by this state machine

PySide2.QtScxml.QScxmlStateMachine. isInitialized ( )
返回类型

bool

PySide2.QtScxml.QScxmlStateMachine. isInvoked ( )
返回类型

bool

PySide2.QtScxml.QScxmlStateMachine. isRunning ( )
返回类型

bool

返回 true if the state machine is running, false 否则。

PySide2.QtScxml.QScxmlStateMachine. loader ( )
返回类型

Loader

另请参阅

setLoader()

PySide2.QtScxml.QScxmlStateMachine. loaderChanged ( loader )
参数

loader Loader

PySide2.QtScxml.QScxmlStateMachine. log ( label , msg )
参数
  • label – unicode

  • msg – unicode

PySide2.QtScxml.QScxmlStateMachine. name ( )
返回类型

unicode

PySide2.QtScxml.QScxmlStateMachine. parseErrors ( )
返回类型

PySide2.QtScxml.QScxmlStateMachine. reachedStableState ( )
PySide2.QtScxml.QScxmlStateMachine. runningChanged ( running )
参数

running bool

PySide2.QtScxml.QScxmlStateMachine. sessionId ( )
返回类型

unicode

PySide2.QtScxml.QScxmlStateMachine. setDataModel ( model )
参数

model QScxmlDataModel

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

另请参阅

dataModel()

PySide2.QtScxml.QScxmlStateMachine. setInitialValues ( initialValues )
参数

initialValues

另请参阅

initialValues()

PySide2.QtScxml.QScxmlStateMachine. setLoader ( loader )
参数

loader Loader

另请参阅

loader()

PySide2.QtScxml.QScxmlStateMachine. setRunning ( running )
参数

running bool

Starts the state machine if running is true , or stops it otherwise.

PySide2.QtScxml.QScxmlStateMachine. setTableData ( tableData )
参数

tableData QScxmlTableData

另请参阅

tableData()

PySide2.QtScxml.QScxmlStateMachine. start ( )

Starts this state machine. The machine will reset its configuration and transition to the initial state. When a final top-level state is entered, the machine will emit the finished() 信号。

注意

A state machine will not run without a running event loop, such as the main application event loop started with exec() or exec() .

PySide2.QtScxml.QScxmlStateMachine. stateNames ( [ compress=true ] )
参数

compress bool

返回类型

字符串列表

Retrieves a list of state names of all states.

compress is true (the default), the states that contain child states will be filtered out and only the leaf states will be returned. When it is false , the full list of all states will be returned.

The returned list does not contain the states of possible nested state machines.

注意

The order of the state names in the list is the order in which the states occurred in the SCXML document.

PySide2.QtScxml.QScxmlStateMachine. stop ( )

Stops this state machine. The machine will not execute any further state transitions. Its running property is set to false .

PySide2.QtScxml.QScxmlStateMachine. submitEvent ( event )
参数

event QScxmlEvent

Submits the SCXML event event to the internal or external event queue depending on the priority of the event.

When a delay is set, the event will be queued for delivery after the timeout has passed. The state machine takes ownership of event and deletes it after processing.

PySide2.QtScxml.QScxmlStateMachine. submitEvent ( eventName )
参数

eventName – unicode

PySide2.QtScxml.QScxmlStateMachine. submitEvent ( eventName , data )
参数
  • eventName – unicode

  • data – object

A utility method to create and submit an external event with the specified eventName as the name and data as the payload data.

PySide2.QtScxml.QScxmlStateMachine. tableData ( )
返回类型

QScxmlTableData

另请参阅

setTableData()

PySide2.QtScxml.QScxmlStateMachine. tableDataChanged ( tableData )
参数

tableData QScxmlTableData