[Qt-interest] Qt state machine: problem while queuing multiple events
Peter Kümmel
syntheticpp at gmx.net
Fri Jun 24 16:02:20 CEST 2011
On 24.06.2011 15:07, Mandeep Sandhu wrote:
>> Hi Mandeep,
>>
>> I don't understand why you could not add also a transition S3->S2 which
>> tests on e3.
>
> I could and that would work.
>
> I guess the confusion arises from the fact that I've over-simplified
> my real SM to the one shown in my example.
>
> I use my SM to control a GUI application. The SM has a 'back' feature
> which essentially means "Go back to wherever you came from" (and hence
> the 'back' event in my example).
>
> The go back feature is achieved by using history states. I just create
> one transition on the BACK event with it's target set to the history
> state. And this is the reason why I was using a single back event to
> go back multiple levels/states in my example as well.
>
> But this, as you've seen, has the issue that multiple events queued
> can cause those many transitions (which are perfectly valid, but which
> I wanted to avoid).
>
> If I want to avoid that, then either I make transitions on unique
> events (that means having a lot of custom events defined) OR hack the
> SM to NOT queue more than 1 event (use one of the public 'undocumented
> APIs').
>
> Hope that clears it! :)
>
Ah, OK. It's like contact bounce with real switches.
Peter
More information about the Qt-interest-old
mailing list