Consider the following state machine:
When the parallel state is entered for the first time, the resulting configuration should be (a2,b1). This is because there is no previous history, so the history state will take the initial transition (instead of restoring the previously stored state). However, QHistoryState only supports a single initial state.
A work-around would be to add a state (let's call it "c") with an unconditional transition to a2 and b1. However, this state needs to be added to the parent state of the history state, which results in an infinite loop in this case: when the transition is taken, it exits a sub-state of the parallel state, which exits the parallel state, which in turn saves the history. Then it enters a2 (which implicitly enters a, which in turn enters the parallel state). By entering the parallel state, it checks the history state, which sees that there is a saved history including "c", so it restores that. Now "c" has an unconditional transition, so we start all over again. Conclusion: this does not work.
The proper fix is to have QHistoryState only handle initial transitions, and "simulate" the current initial state by setting it as the target for that initial transition.
|For Gerrit Dashboard: QTBUG-46703|
|114774,5||QStateMachine: add defaultTransition in QHistoryState||dev||qt/qtbase||Status: MERGED||-2||0|