Hi, 

 

I am currently evaluating the Qt State Machine Framework, and I am
facing an issue with the QtSignalTransition.

 

The current implementation does not allow to perform an action on a
QtSignalTransition.

The action can be added to the transition, but the corresponding action
is never performed.

 

My code is pretty simple:

 

      // Let's create the state machine

      m_stateMachine = new QtStateMachine( this );

 

      // Let's create the states

      QtState* state1 = new QtState();

      QtState* state2 = new QtState();

 

      // Let's add the states to the state machine

      m_stateMachine->addState( state1 );

      m_stateMachine->addState( state2 );

 

      // Let's add a transition between the 2 states.

      // So we create 1 transition

      QtSignalTransition* transition12 = new QtSignalTransition(
ui.myButton, SIGNAL(clicked() ) );

 

      // The transition will invoke this->myMethod()

      transition12->invokeMethodOnTransition( this, "myMethod" );

 

      // The transition goes from state1 to state2

      state1->addTransition( transition12, state2 );

 

      // Let's say we start in state1

      m_stateMachine->setInitialState( state1 );

 

      // and start the state machine

      m_stateMachine->start();

 

Am I right in thinking that it is an error, or is it a design point that
I haven't understood?

This behavior is due to the empty implementation of
QtSignalTransition::onTransition()

-      If this behaviour is not normal, removing the
QtSignalTransition::onTransition() method, or calling
QtTransition::onTransition() in QtSignalTransition::onTransition() would
solve the problem.

-      If this behavior is normal, then I would expect one of the
following two possibilities:

1.     QtSignalTransition should implement invokeMethodOnTransition and
setPropertyOnTransition as protected methods. This would return a
compilation error whenever I try to call them.

2.     A warning should be displayed in the debug window when calling
one of the functions above.

 

I understand that I could derive my own signal transition class from
QtSignalTransition and define my own action by overriding onExecute(),
but why should QtSignalTransition not trigger any action?

 

Best regards

 

 

Jean-Yves Reutter 
Software Developer



_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to