QAbstractTransition 类

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

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

公共类型

enum TransitionType { ExternalTransition, InternalTransition }

特性

公共函数

QAbstractTransition (QState * sourceState = nullptr)
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 *> & 目标 )
void setTransitionType (QAbstractTransition::TransitionType type )
QState * sourceState () const
QAbstractState * targetState () const
QList<QAbstractState *> targetStates () const
QAbstractTransition::TransitionType transitionType () const

信号

void targetStateChanged ()
void targetStatesChanged ()
void triggered ()

静态公共成员

const QMetaObject staticMetaObject

保护函数

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

重实现保护函数

virtual bool event (QEvent * e ) override

额外继承成员

详细描述

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.

成员类型文档编制

enum QAbstractTransition:: TransitionType

This enum specifies the kind of transition. By default, the type is an external transition.

常量 描述
QAbstractTransition::ExternalTransition 0 Any state that is the source state of a transition (which is not a target-less transition) is left, and re-entered when necessary.
QAbstractTransition::InternalTransition 1 If the target state of a transition is a sub-state of a compound state, and that compound state is the source state, an internal transition will not leave the source state.

另请参阅 QAbstractTransition::transitionType .

特性文档编制

sourceState : QState * const

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

访问函数:

QState * sourceState () const

targetState : QAbstractState *

此特性保持此过渡的目标状态

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 )

通知程序信号:

void targetStateChanged () [见下文注意事项]

注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。

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 *> & 目标 )

通知程序信号:

void targetStatesChanged () [见下文注意事项]

注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。

transitionType : TransitionType

indicates whether this transition is an internal transition, or an external transition.

Internal and external transitions behave the same, except for the case of a transition whose source state is a compound state and whose target(s) is a descendant of the source. In such a case, an internal transition will not exit and re-enter its source state, while an external one will.

By default, the type is an external transition.

访问函数:

QAbstractTransition::TransitionType transitionType () const
void setTransitionType (QAbstractTransition::TransitionType type )

成员函数文档编制

QAbstractTransition:: QAbstractTransition ( QState * sourceState = nullptr)

构造新的 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 ().

[override 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 ().

void QAbstractTransition:: setTargetState ( QAbstractState * target )

设置 target state of this transition.

注意: setter 函数对于特性 targetState .

另请参阅 targetState ().

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

Sets the target states of this transition to be the given 目标 .

注意: setter 函数对于特性 targetStates .

另请参阅 targetStates ().

void QAbstractTransition:: setTransitionType ( QAbstractTransition::TransitionType type )

Sets the type of the transition to type .

注意: setter 函数对于特性 transitionType .

另请参阅 transitionType ().

QState *QAbstractTransition:: sourceState () const

Returns the source state of this transition, or 0 if this transition has no source state.

注意: getter 函数对于特性 sourceState .

QAbstractState *QAbstractTransition:: targetState () const

Returns the target state of this transition, or 0 if the transition has no target.

注意: getter 函数对于特性 targetState .

另请参阅 setTargetState ().

[signal] void QAbstractTransition:: targetStateChanged ()

此信号发射当 targetState 特性改变。

该函数在 Qt 5.4 引入。

注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。

注意: 通知程序信号对于特性 targetState .

另请参阅 QAbstractTransition::targetState .

QList < QAbstractState *> QAbstractTransition:: targetStates () const

Returns the target states of this transition, or an empty list if this transition has no target states.

注意: getter 函数对于特性 targetStates .

另请参阅 setTargetStates ().

[signal] void QAbstractTransition:: targetStatesChanged ()

此信号发射当 targetStates 特性改变。

该函数在 Qt 5.4 引入。

注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。

注意: 通知程序信号对于特性 targetStates .

另请参阅 QAbstractTransition::targetStates .

QAbstractTransition::TransitionType QAbstractTransition:: transitionType () const

Returns the type of the transition.

注意: getter 函数对于特性 transitionType .

另请参阅 setTransitionType ().

[signal] void QAbstractTransition:: triggered ()

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

注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。