View Full Version : Passing signal parameters when state changes in the state machine

19th December 2010, 17:03

I have a situation which looks like that.

I have a class ( we will call it from now on TestClass ) which contain a state machine. There are a few states. This class can get same signal from outside word( we will call it from now on testSignal). This signal contain some data so its declaration will be void testSignal(int index). The testSignal can arrive any time. And now example situation.

1)the state machine is in the idle state
2)testSignal arrive
3)the state machine change state to the work state
4)when the work state is entered, the testSignal date is forwarded to some member field object (we will call it from now on testMember) of TestClass by some signal
5)testSignal arrive and it is ignored

I haven't find any informations how to execute point 4. In examples signal passed to the state machine never contain parameters. Google also wasn't helpful.

I have tried to inherit QSignalTransition but I got stuck at the beginning.
I could also write parameters when the testSignal arrived. Disconnect signal from slot when the work state was entered and send data after that to testMember. But there is no guarantee that TestClass won't get another testSignal and which will override data before we disconnect signal from state.

I hope I was clear enough. Do you have any propositions?