The QEventTransition class provides a QObject-specific transition for Qt events. More...
#include <QEventTransition>
Inherits: QAbstractTransition.
Inherited by: QKeyEventTransition and QMouseEventTransition.
This class was introduced in Qt 4.6.
QEventTransition ( QState * sourceState = 0 ) | |
QEventTransition ( QObject * object, QEvent::Type type, QState * sourceState = 0 ) | |
~QEventTransition () | |
QObject * | eventSource () const |
QEvent::Type | eventType () const |
void | setEventSource ( QObject * object ) |
void | setEventType ( QEvent::Type type ) |
virtual bool | event ( QEvent * e ) |
virtual bool | eventTest ( QEvent * event ) |
virtual void | onTransition ( QEvent * event ) |
The QEventTransition class provides a QObject-specific transition for Qt events.
A QEventTransition object binds an event to a particular QObject. QEventTransition is part of The State Machine Framework.
Example:
QPushButton *button = ...; QState *s1 = ...; QState *s2 = ...; // If in s1 and the button receives an Enter event, transition to s2 QEventTransition *enterTransition = new QEventTransition(button, QEvent::Enter); enterTransition->setTargetState(s2); s1->addTransition(enterTransition); // If in s2 and the button receives an Exit event, transition back to s1 QEventTransition *leaveTransition = new QEventTransition(button, QEvent::Leave); leaveTransition->setTargetState(s1); s2->addTransition(leaveTransition);
When reimplementing the eventTest() function, you should first call the base implementation to verify that the event is a QStateMachine::WrappedEvent for the proper object and event type. You may then cast the event to a QStateMachine::WrappedEvent and get the original event by calling QStateMachine::WrappedEvent::event(), and perform additional checks on that object.
See also QState::addTransition().
This property holds the event source that this event transition is associated with.
Access functions:
QObject * | eventSource () const |
void | setEventSource ( QObject * object ) |
This property holds the type of event that this event transition is associated with.
Access functions:
QEvent::Type | eventType () const |
void | setEventType ( QEvent::Type type ) |
Constructs a new QEventTransition object with the given sourceState.
Constructs a new QEventTransition object associated with events of the given type for the given object, and with the given sourceState.
Destroys this QObject event transition.
Reimplemented from QObject::event().
Reimplemented from QAbstractTransition::eventTest().
Reimplemented from QAbstractTransition::onTransition().
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.