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