QAbstractTransition 類是過渡基類介於 QAbstractState 對象。 更多...
| 頭: | #include <QAbstractTransition> |
| qmake: | QT += core |
| Since: | Qt 4.6 |
| 繼承: | QObject |
| 繼承者: |
該類在 Qt 4.6 引入。
| 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 () |
| virtual bool | eventTest (QEvent * event ) = 0 |
| virtual void | onTransition (QEvent * event ) = 0 |
| virtual bool | event (QEvent * e ) override |
QAbstractTransition 類是過渡抽象基類介於狀態 ( 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.
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 .
This property holds the source state (parent) of this transition
訪問函數:
| QState * | sourceState () const |
此特性保持此過渡的目標狀態
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 () | [見下文注意事項] |
注意: 這是私有信號。它可以用於信號連接,但不能由用戶發射。
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 () | [見下文注意事項] |
注意: 這是私有信號。它可以用於信號連接,但不能由用戶發射。
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 ) |
Constructs a new QAbstractTransition object with the given sourceState .
[signal]
void
QAbstractTransition::
targetStateChanged
()
此信號發射,當 targetState 特性改變。
注意: 這是私有信號。它可以用於信號連接,但不能由用戶發射。
注意: 通知程序信號對於特性 targetState .
該函數在 Qt 5.4 引入。
另請參閱 QAbstractTransition::targetState .
[signal]
void
QAbstractTransition::
targetStatesChanged
()
此信號發射,當 targetStates 特性改變。
注意: 這是私有信號。它可以用於信號連接,但不能由用戶發射。
注意: 通知程序信號對於特性 targetStates .
該函數在 Qt 5.4 引入。
另請參閱 QAbstractTransition::targetStates .
[signal]
void
QAbstractTransition::
triggered
()
This signal is emitted when the transition has been triggered (after onTransition () has been called).
注意: 這是私有信號。它可以用於信號連接,但不能由用戶發射。
[虛擬]
QAbstractTransition::
~QAbstractTransition
()
Destroys this transition.
添加給定 animation to this transition. The transition does not take ownership of the animation.
另請參閱 removeAnimation () 和 animations ().
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 (QEvent *e).
[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.
Returns the state machine that this transition is part of, or
nullptr
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.
移除給定 animation from this transition.
另請參閱 addAnimation ().
設置 target state of this transition.
注意: setter 函數對於特性 targetState .
另請參閱 targetState ().
Sets the target states of this transition to be the given 目標 .
注意: setter 函數對於特性 targetStates .
另請參閱 targetStates ().
Sets the type of the transition to type .
注意: setter 函數對於特性 transitionType .
另請參閱 transitionType ().
Returns the source state of this transition, or
nullptr
if this transition has no source state.
注意: Getter function for property sourceState.
Returns the target state of this transition, or
nullptr
if the transition has no target.
注意: Getter function for property targetState.
另請參閱 setTargetState ().
Returns the target states of this transition, or an empty list if this transition has no target states.
注意: Getter function for property targetStates.
另請參閱 setTargetStates ().
Returns the type of the transition.
注意: Getter function for property transitionType.
另請參閱 setTransitionType ().