PDA

View Full Version : QStateMachine - can a generic signal trigger a state transition?



giovanni
7th August 2010, 15:04
Hello everybody!
I'm getting trouble understanding how to schedule a state transition based on a generic QObject signal.
I mean, how can I make something like the following to work?
start_state.addTransition(generic_object, SIGNAL(generic_signal), end_state);
Is there any work-around to solve this?
I'm also including a convenience code snapshot.
Thanks for your help. Giovanni

giovanni
7th August 2010, 23:38
I think I can answer my own question. The answer is YES! and the problem was .. the even loop.
Even if I already called the state machine's start() method, it doesn't process anything until the application event loop is made running.
So events that occur in the meantime do not trigger the expected processing as setup by the addTransition call (they are NOT QUEUED, they get LOST).
I posted a revised working version of my snapshot for the curious.
Ciao a tutti.