For example, let's say I have some QButtonBucket
class containing some number N QPushButton
s within it, and I want pushing any of those buttons to cause a transition from some state to another. This is simple enough:
for button in button_bucket.get_buttons():
state_1.addTransition(button.clicked, state_2)
However, let's say I want to do something with the source QPushButton
that causes the transition, such as changing its color if the transition is from state_1
to state_2
, or maybe disabling it if the transition is from state_3
back to state_1
I want to handle this within the tight bounds of the QStateMachine
logic due to the asynchronous nature of QStateMachine
s. I don't want to have to track what button was clicked, or any other stateful data for that matter, within QButtonBucket
.
If there was a way to acquire arguments passed along with the signal identified in addTransition
, and act on them after the new state is entered, that would be pretty much perfect. But I'm not seeing an easy solution to implement that.
Is there a known-good way of achieving what I'm trying to accomplish?