PySide6.QtStateMachine.QState¶
- class QState¶
- The - QStateclass provides a general-purpose state for- QStateMachine. More…- Inherited by: - QStateMachine- Synopsis¶- Properties¶- childModeᅟ- The child mode of this state
- errorStateᅟ- The error state of this state
- initialStateᅟ- The initial state of this state (one of its child states)
 - Methods¶- def - __init__()
- def - addTransition()
- def - assignProperty()
- def - childMode()
- def - errorState()
- def - initialState()
- def - setChildMode()
- def - setErrorState()
- def - transitions()
 - Signals¶
- def - finished()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- QStateobjects can have child states, and can have transitions to other states.- QStateis part of Qt State Machine Framework .- The - addTransition()function adds a transition. The- removeTransition()function removes a transition. The- transitions()function returns the state’s outgoing transitions.- The - assignProperty()function is used for defining property assignments that should be performed when a state is entered.- Top-level states must be passed a - QStateMachineobject as their parent state, or added to a state machine using- addState().- States with Child States¶- The - childModeproperty determines how child states are treated. For non-parallel state groups, the- setInitialState()function must be called to set the initial state. The child states are mutually exclusive states, and the state machine needs to know which child state to enter when the parent state is the target of a transition.- The state emits the - finished()signal when a final child state (- QFinalState) is entered.- The - setErrorState()sets the state’s error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set).- class ChildMode¶
- This enum specifies how a state’s child states are treated. - Constant - Description - QState.ChildMode.ExclusiveStates - The child states are mutually exclusive and an initial state must be set by calling - setInitialState().- QState.ChildMode.ParallelStates - The child states are parallel. When the parent state is entered, all its child states are entered in parallel. 
 - class RestorePolicy¶
- This enum specifies the restore policy type. The restore policy takes effect when the machine enters a state which sets one or more properties. If the restore policy is set to RestoreProperties, the state machine will save the original value of the property before the new value is set. - Later, when the machine either enters a state which does not set a value for the given property, the property will automatically be restored to its initial value. - Only one initial value will be saved for any given property. If a value for a property has already been saved by the state machine, it will not be overwritten until the property has been successfully restored. - Constant - Description - QState.RestorePolicy.DontRestoreProperties - The state machine should not save the initial values of properties and restore them later. - QState.RestorePolicy.RestoreProperties - The state machine should save the initial values of properties and restore them later. - See also 
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property childModeᅟ: QState.ChildMode¶
 - This property holds the child mode of this state. - The default value of this property is - ExclusiveStates.- Access functions:
 - property errorStateᅟ: QAbstractState¶
 - This property holds the error state of this state. - Access functions:
 - property initialStateᅟ: QAbstractState¶
 - This property holds the initial state of this state (one of its child states). - Access functions:
 - Constructs a new state with the given - parentstate.- Constructs a new state with the given - childModeand the given- parentstate.- addTransition(target)¶
- Parameters:
- target – - QAbstractState
- Return type:
 
 - Adds an unconditional transition from this state to the given - targetstate, and returns then new transition object.- addTransition(transition)
- Parameters:
- transition – - QAbstractTransition
 
 - Adds the given - transition. The transition has this state as the source. This state takes ownership of the transition.- addTransition(signal, arg__2)
- Parameters:
- signal – object 
- arg__2 – - QAbstractState
 
- Return type:
 
 - addTransition(sender, signal, target)
- Parameters:
- sender – - QObject
- signal – str 
- target – - QAbstractState
 
- Return type:
 
 - Adds a transition associated with the given - signalof the given- senderobject, and returns the new QSignalTransition object. The transition has this state as the source, and the given- targetas the target state.- Instructs this state to set the property with the given - nameof the given- objectto the given- valuewhen the state is entered.- See also - Returns the child mode of this state. - See also - Getter of property - childModeᅟ.- childModeChanged()¶
 - This signal is emitted when the - childModeproperty is changed.- See also - Notification signal of property - childModeᅟ.- errorState()¶
- Return type:
 
 - Returns this state’s error state. - See also - Getter of property - errorStateᅟ.- errorStateChanged()¶
 - This signal is emitted when the - errorStateproperty is changed.- See also - Notification signal of property - errorStateᅟ.- finished()¶
 - This signal is emitted when a final child state of this state is entered. - See also - initialState()¶
- Return type:
 
 - Returns this state’s initial state, or - Noneif the state has no initial state.- See also - Getter of property - initialStateᅟ.- initialStateChanged()¶
 - This signal is emitted when the - initialStateproperty is changed.- See also - Notification signal of property - initialStateᅟ.- propertiesAssigned()¶
 - This signal is emitted when all properties have been assigned their final value. If the state assigns a value to one or more properties for which an animation exists (either set on the transition or as a default animation on the state machine), then the signal will not be emitted until all such animations have finished playing. - If there are no relevant animations, or no property assignments defined for the state, then the signal will be emitted immediately before the state is entered. - See also - assignProperty()and- addAnimation()- removeTransition(transition)¶
- Parameters:
- transition – - QAbstractTransition
 
 - Removes the given - transitionfrom this state. The state releases ownership of the transition.- See also - Sets the child - modeof this state.- See also - Setter of property - childModeᅟ.- setErrorState(state)¶
- Parameters:
- state – - QAbstractState
 
 - Sets this state’s error state to be the given - state. If the error state is not set, or if it is set to- None, the state will inherit its parent’s error state recursively. If no error state is set for the state itself or any of its ancestors, an error will cause the machine to stop executing and an error will be printed to the console.- See also - Setter of property - errorStateᅟ.- setInitialState(state)¶
- Parameters:
- state – - QAbstractState
 
 - Sets this state’s initial state to be the given - state.- statehas to be a child of this state.- See also - Setter of property - initialStateᅟ.- transitions()¶
- Return type:
- .list of QAbstractTransition 
 
 - Returns this state’s outgoing transitions (i.e. transitions where this state is the - source state), or an empty list if this state has no outgoing transitions.- See also