QAbstractTransition 类

The QAbstractTransition class is the base class of transitions between QAbstractState 对象。 更多...

头: #include <QAbstractTransition>
Since: Qt 4.6
继承: QObject
继承者: QEventTransition and QSignalTransition

特性

公共函数

QAbstractTransition (QState * sourceState = 0)
virtual ~QAbstractTransition ()
void addAnimation (QAbstractAnimation * animation )
QList<QAbstractAnimation *> animations () const
QStateMachine * machine () const
void removeAnimation (QAbstractAnimation * animation )
void setTargetState (QAbstractState * target )
void setTargetStates (const QList<QAbstractState *> & 目标 )
QState * sourceState () const
QAbstractState * targetState () const
QList<QAbstractState *> targetStates () const

信号

void triggered ()

保护函数

virtual bool eventTest (QEvent * event ) = 0
virtual void onTransition (QEvent * event ) = 0

重实现保护函数

virtual bool event (QEvent * e )

额外继承成员

详细描述

The QAbstractTransition class is the base class of transitions between QAbstractState 对象。

The QAbstractTransition class is the abstract base class of transitions between states ( QAbstractState 对象) 的 QStateMachine . QAbstractTransition 属于 状态机框架 .

The sourceState () 函数返回过渡源。 targetStates () 函数返回过渡目标。 machine () 函数返回过渡所属的状态机。

The triggered () 信号发射当过渡被触发时。

过渡可以导致动画播放。使用 addAnimation () 函数以将动画添加到过渡。

子类化

The eventTest () function is called by the state machine to determine whether an event should trigger the transition. In your reimplementation you typically check the event type and cast the event object to the proper type, and check that one or more properties of the event meet your criteria.

The onTransition () function is called when the transition is triggered; reimplement this function to perform custom processing for the transition.

特性文档编制

sourceState : QState * const

This property holds the source state (parent) of this transition.

访问函数:

QState * sourceState () const

targetState : QAbstractState *

This property holds the target state of this transition.

If a transition has no target state, the transition may still be triggered, but this will not cause the state machine's configuration to change (i.e. the current state will not be exited and re-entered).

访问函数:

QAbstractState * targetState () const
void setTargetState (QAbstractState * target )

targetStates : QList < QAbstractState *>

This property holds the target states of this transition.

If multiple states are specified, all must be descendants of the same parallel group state.

访问函数:

QList<QAbstractState *> targetStates () const
void setTargetStates (const QList<QAbstractState *> & 目标 )

成员函数文档编制

QAbstractTransition:: QAbstractTransition ( QState * sourceState = 0)

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

[虚拟] QAbstractTransition:: ~QAbstractTransition ()

Destroys this transition.

void QAbstractTransition:: addAnimation ( QAbstractAnimation * animation )

添加给定 animation to this transition. The transition does not take ownership of the animation.

另请参阅 removeAnimation () 和 animations ().

QList < QAbstractAnimation *> QAbstractTransition:: animations () const

Returns the list of animations associated with this transition, or an empty list if it has no animations.

另请参阅 addAnimation ().

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

重实现自 QObject::event ().

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

This function is called to determine whether the given event should cause this transition to trigger. Reimplement this function and return true if the event should trigger the transition, otherwise return false.

QStateMachine * QAbstractTransition:: machine () const

Returns the state machine that this transition is part of, or 0 if the transition is not part of a state machine.

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

This function is called when the transition is triggered. The given event is what caused the transition to trigger. Reimplement this function to perform custom processing when the transition is triggered.

void QAbstractTransition:: removeAnimation ( QAbstractAnimation * animation )

移除给定 animation from this transition.

另请参阅 addAnimation ().

[signal] void QAbstractTransition:: triggered ()

This signal is emitted when the transition has been triggered (after onTransition () has been called).