[Qt-interest] was event accepted by state machine?

Maxim Kirillov max630 at gmail.com
Tue Feb 1 13:48:43 CET 2011


Hello

Let's say I have a QStateMachine. For some event there are
states that have transition defined for that event and
states that does not listen for that event.

I would like to trigger the event and know if it was
accepted.

I guess the most appropriate way for triggering event will
be inherit from QAbstractTransition with eventTest, like
described in
http://doc.qt.nokia.com/4.7/statemachine-api.html#events-transitions-and-guards

But, as the documentation for postEvent says, "This function
returns immediately. The event is added to the state
machine's event queue". So I do not know is the event
processed or just ignored.

The only solution that comes to mind is create a fake "bad"
state and define transition to that state for each state
that should not react to it. But this raises a lot of
question with keeping history and adding events for that
state and so on. So, it would be much better to have a
straightforward way to know is an event, signal or whatever
is really listened for by the state machine.

--
Max



More information about the Qt-interest-old mailing list