QEventTransition Class
The QEventTransition class provides a QObject-specific transition for Qt events. 更多...
头文件: | #include <QEventTransition> |
qmake: | QT += core |
开始支持版本: | Qt 4.6 |
基类: | QAbstractTransition |
属性
- eventSource : QObject *
- eventType : QEvent::Type
- 4 个属性继承自 QAbstractTransition
- 1 个属性继承自 QObject
公有函数
QEventTransition(QState *sourceState = Q_NULLPTR) | |
QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = Q_NULLPTR) | |
~QEventTransition() | |
QObject * | eventSource() const |
QEvent::Type | eventType() const |
void | setEventSource(QObject *object) |
void | setEventType(QEvent::Type type) |
- 11 个公有函数继承自 QAbstractTransition
- 32 个公有函数继承自 QObject
重新实现的受保护函数
virtual bool | event(QEvent *e) |
virtual bool | eventTest(QEvent *event) |
virtual void | onTransition(QEvent *event) |
- 3 个受保护的函数继承自 QAbstractTransition
- 9 个受保护的函数继承自 QObject
其他继承的成员
- 1 个公有槽函数继承自 QObject
- 3 个信号继承自 QAbstractTransition
- 2 个信号继承自 QObject
- 11 个静态公有成员继承自 QObject
- 3 个受保护的函数继承自 QAbstractTransition
- 9 个受保护的函数继承自 QObject
详细描述
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);
Subclassing
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.
参见 QState::addTransition().
属性
eventSource : QObject *
This property holds the event source that this event transition is associated with
访问函数:
QObject * | eventSource() const |
void | setEventSource(QObject *object) |
eventType : QEvent::Type
This property holds the type of event that this event transition is associated with
访问函数:
QEvent::Type | eventType() const |
void | setEventType(QEvent::Type type) |
成员函数
QEventTransition::QEventTransition(QState *sourceState = Q_NULLPTR)
Constructs a new QEventTransition object with the given sourceState.
QEventTransition::QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = Q_NULLPTR)
Constructs a new QEventTransition object associated with events of the given type for the given object, and with the given sourceState.
QEventTransition::~QEventTransition()
Destroys this QObject event transition.
[virtual protected]
bool QEventTransition::event(QEvent *e)
Reimplemented from QObject::event().
QObject *QEventTransition::eventSource() const
Returns the event source associated with this event transition.
Note: Getter function for property eventSource.
参见 setEventSource().
[virtual protected]
bool QEventTransition::eventTest(QEvent *event)
Reimplemented from QAbstractTransition::eventTest().
QEvent::Type QEventTransition::eventType() const
Returns the event type that this event transition is associated with.
Note: Getter function for property eventType.
参见 setEventType().
[virtual protected]
void QEventTransition::onTransition(QEvent *event)
Reimplemented from QAbstractTransition::onTransition().
void QEventTransition::setEventSource(QObject *object)
Sets the event source associated with this event transition to be the given object.
Note: Setter function for property eventSource.
参见 eventSource().
void QEventTransition::setEventType(QEvent::Type type)
Sets the event type that this event transition is associated with.
Note: Setter function for property eventType.
参见 eventType().