QEventTransition 类

QEventTransition 类提供 QObject 特定过渡为 Qt 事件。 更多...

头: #include <QEventTransition>
qmake: QT += core
Since: Qt 4.6
继承: QAbstractTransition
继承者:

QKeyEventTransition and QMouseEventTransition

特性

公共函数

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 )

重实现保护函数

virtual bool event (QEvent * e )
virtual bool eventTest (QEvent * event )
virtual void onTransition (QEvent * event )

额外继承成员

详细描述

QEventTransition 类提供 QObject 特定过渡为 Qt 事件。

A QEventTransition object binds an event to a particular QObject . QEventTransition is part of 状态机框架 .

范例:

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);
					

子类化

当重实现 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)

构造新的 QEventTransition 对象采用给定 sourceState .

QEventTransition:: QEventTransition ( QObject * object , QEvent::Type type , QState * sourceState = Q_NULLPTR)

构造新的 QEventTransition object associated with events of the given type 为给定 object ,和采用给定 sourceState .

QEventTransition:: ~QEventTransition ()

销毁此 QObject event transition.

[virtual protected] bool QEventTransition:: event ( QEvent * e )

重实现自 QObject::event ().

QObject *QEventTransition:: eventSource () const

Returns the event source associated with this event transition.

注意: Getter 函数对于特性 eventSource .

另请参阅 setEventSource ().

[virtual protected] bool QEventTransition:: eventTest ( QEvent * event )

重实现自 QAbstractTransition::eventTest ().

QEvent::Type QEventTransition:: eventType () const

Returns the event type that this event transition is associated with.

注意: Getter 函数对于特性 eventType .

另请参阅 setEventType ().

[virtual protected] void QEventTransition:: onTransition ( QEvent * event )

重实现自 QAbstractTransition::onTransition ().

void QEventTransition:: setEventSource ( QObject * object )

Sets the event source associated with this event transition to be the given object .

注意: Setter 函数对于特性 eventSource .

另请参阅 eventSource ().

void QEventTransition:: setEventType ( QEvent::Type type )

Sets the event type that this event transition is associated with.

注意: Setter 函数对于特性 eventType .

另请参阅 eventType ().