[Qt-interest] Qt State machine framework

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Wed Mar 24 10:21:17 CET 2010


On Fri, Mar 12, 2010 at 11:03 AM,  <noam.rosenthal at nokia.com> wrote:
> Hi Mandeep
> Actually both things are supported!
>
> 1. http://doc.trolltech.com/4.6/qabstracttransition.html#triggered: A signal that gets emitted when a transition is triggered. You can then query the tranistion's source/target properties.

Actually this approach has a problem if transitioning to/from a super
state or a history state. I'm actually interested in emitting
transition info for lowest level child states.

So eg if I return to a history state, my signal should tell which
child state was entered and what was the source state. If the source
state had children, then i need info about which child state was left.

I can think of recording states on my own (using the onEntry/onExit
fxns). Is there any other way?

Thanks,
-mandeep

> 2. http://doc.trolltech.com/4.6/qstatemachine.html#configuration: QStateMachine::configuration(), returns a set of current states.
>
> Hope this answers your question,
>
> Regards
> No'am
>
>>-----Original Message-----
>>From: qt-interest-bounces at trolltech.com
>>[mailto:qt-interest-bounces at trolltech.com] On Behalf Of ext
>>Mandeep Sandhu
>>Sent: Friday, March 12, 2010 2:20 PM
>>To: qt-interest at trolltech.com
>>Subject: [Qt-interest] Qt State machine framework
>>
>>Hi All,
>>
>>I'm planning to implement a FSM for one of my apps using the
>>Qt State machine framework. I have some requirements which
>>somehow are not there in this frame work by default (maybe I'm
>>missing something).
>>They are:
>>
>>* I need to emit a signal whenever the FSM transitions from 1
>>state to another. The signal emits the old state and the new state
>>* I need to provide an API to a caller to let it know what the
>>current state the FSM is in.
>>
>>For the 1st requirement I could not find an existing API's
>>which can do that (only started, stopped, finished signals are
>>emitted by the qtstatemachine class).
>>
>>I can think of many ways to do it, eg: create my own
>>transition and emit a signal in it's onTransition() method,
>>create my own state (subclassing the QtAbstractState and emit
>>a signal in it's onEntry method...though I won't have the
>>previous state then...)
>>
>>For the second part I need to keep updating some member of my
>>class to keep track of the current state (lame).
>>
>>Any suggestions on better approaches (if any)?
>>
>>Thanks,
>>-mandeep
>>_______________________________________________
>>Qt-interest mailing list
>>Qt-interest at trolltech.com
>>http://lists.trolltech.com/mailman/listinfo/qt-interest
>>



More information about the Qt-interest-old mailing list