PySide6.QtStateMachine.QHistoryState¶
- class QHistoryState¶
- The - QHistoryStateclass provides a means of returning to a previously active substate. More…- Synopsis¶- Properties¶- defaultStateᅟ- The default state of this history state
- defaultTransitionᅟ- The default transition of this history state
- historyTypeᅟ- The type of history that this history state records
 - Methods¶- def - __init__()
- def - defaultState()
- def - historyType()
- def - setHistoryType()
 - Signals¶- 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¶- A history state is a pseudo-state that represents the child state that the parent state was in the last time the parent state was exited. A transition with a history state as its target is in fact a transition to one or more other child states of the parent state. - QHistoryStateis part of Qt State Machine Framework .- Use the - setDefaultState()function to set the state that should be entered if the parent state has never been entered. Example:- machine = QStateMachine() s1 = QState() s11 = QState(s1) s12 = QState(s1) s1h = QHistoryState(s1) s1h.setDefaultState(s11) machine.addState(s1) s2 = QState() machine.addState(s2) button = QPushButton() # Clicking the button will cause the state machine to enter the child state # that s1 was in the last time s1 was exited, or the history state's default # state if s1 has never been entered. s1.addTransition(button.clicked, s1h) - If more than one default state has to be entered, or if the transition to the default state(s) has to be acted upon, the - defaultTransitionshould be set instead. Note that the eventTest() method of that transition will never be called: the selection and execution of the transition is done automatically when entering the history state.- By default a history state is shallow, meaning that it won’t remember nested states. This can be configured through the - historyTypeproperty.- class HistoryType¶
- This enum specifies the type of history that a - QHistoryStaterecords.- Constant - Description - QHistoryState.ShallowHistory - Only the immediate child states of the parent state are recorded. In this case a transition with the history state as its target will end up in the immediate child state that the parent was in the last time it was exited. This is the default. - QHistoryState.DeepHistory - Nested states are recorded. In this case a transition with the history state as its target will end up in the most deeply nested descendant state the parent was in the last time it was exited. 
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property defaultStateᅟ: QAbstractState¶
 - This property holds the default state of this history state. - Access functions:
 - property defaultTransitionᅟ: QAbstractTransition¶
 - This property holds the default transition of this history state. - Access functions:
 - property historyTypeᅟ: QHistoryState.HistoryType¶
 - This property holds the type of history that this history state records. - The default value of this property is - ShallowHistory.- Access functions:
 - Constructs a new shallow history state with the given - parentstate.- __init__(type[, parent=None])
- Parameters:
- type – - HistoryType
- parent – - QState
 
 
 - Constructs a new history state of the given - type, with the given- parentstate.- defaultState()¶
- Return type:
 
 - Returns this history state’s default state. The default state indicates the state to transition to if the parent state has never been entered before. - See also - Getter of property - defaultStateᅟ.- defaultStateChanged()¶
 - This signal is emitted when the - defaultStateproperty is changed.- See also - Notification signal of property - defaultStateᅟ.- defaultTransition()¶
- Return type:
 
 - Returns this history state’s default transition. The default transition is taken when the history state has never been entered before. The target states of the default transition therefore make up the default state. - See also - Getter of property - defaultTransitionᅟ.- defaultTransitionChanged()¶
 - This signal is emitted when the - defaultTransitionproperty is changed.- See also - Notification signal of property - defaultTransitionᅟ.- historyType()¶
- Return type:
 
 - Returns the type of history that this history state records. - See also - Getter of property - historyTypeᅟ.- historyTypeChanged()¶
 - This signal is emitted when the - historyTypeproperty is changed.- See also - Notification signal of property - historyTypeᅟ.- setDefaultState(state)¶
- Parameters:
- state – - QAbstractState
 
 - Sets this history state’s default state to be the given - state.- statemust be a sibling of this history state.- Note that this function does not set - stateas the initial state of its parent.- See also - Setter of property - defaultStateᅟ.- setDefaultTransition(transition)¶
- Parameters:
- transition – - QAbstractTransition
 
 - Sets this history state’s default transition to be the given - transition. This will set the source state of the- transitionto the history state.- Note that the eventTest method of the - transitionwill never be called.- See also - Setter of property - defaultTransitionᅟ.- setHistoryType(type)¶
- Parameters:
- type – - HistoryType
 
 - Sets the - typeof history that this history state records.- See also - Setter of property - historyTypeᅟ.