<code>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)</code>