Home |
The QtEventTransition class provides a QObject-specific transition for Qt events. More...
#include <QtEventTransition>
Inherits QtTransition.
This class was introduced in qtstatemachine 4.6.
The QtEventTransition class provides a QObject-specific transition for Qt events.
A QtEventTransition object binds an event to a particular QObject. QtEventTransition is part of The State Machine Framework.
Example:
QPushButton *button = ...; QtState *s1 = ...; QtState *s2 = ...; // If in s1 and the button receives an Enter event, transition to s2 QtEventTransition *enterTransition = new QtEventTransition(button, QEvent::Enter); enterTransition->setTargetState(s2); s1->addTransition(enterTransition); // If in s2 and the button receives an Exit event, transition back to s1 QtEventTransition *leaveTransition = new QtEventTransition(button, QEvent::Leave); leaveTransition->setTargetState(s1); s2->addTransition(leaveTransition);
Many event classes have attributes in addition to the event type itself. The testEventCondition() function can be reimplemented to check attributes of an event instance in order to determine whether the transition should be triggered or not.
See also QtState::addTransition().
This property holds the type of event that this event transition is associated with.
Access functions:
This property holds the event source that this event transition is associated with.
Access functions:
Constructs a new QtEventTransition object with the given sourceState.
Constructs a new QtEventTransition object associated with events of the given type for the given object, and with the given sourceState.
Constructs a new QtEventTransition object associated with events of the given type for the given object. The transition has the given targets and sourceState.
Destroys this QObject event transition.
Tests an instance of an event associated with this event transition and returns true if the transition should be taken, otherwise returns false. The type of the given event will be eventType().
Reimplement this function if you have custom conditions associated with the transition. The default implementation always returns true.
Copyright © 2009 Nokia | Trademarks | Qt Solutions |