QAbstractTransition 类是过渡基类介于 QAbstractState 对象。 更多...
头: | #include <QAbstractTransition> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS StateMachine)
target_link_libraries(mytarget PRIVATE Qt6::StateMachine) |
qmake: | QT += statemachine |
继承: | QObject |
继承者: |
enum | TransitionType { ExternalTransition, InternalTransition } |
QAbstractTransition (QState * sourceState = nullptr) | |
virtual | ~QAbstractTransition () |
void | addAnimation (QAbstractAnimation * animation ) |
QList<QAbstractAnimation *> | animations () const |
QBindable<QAbstractTransition::TransitionType> | bindableTransitionType () |
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 属于 Qt State Machine Framework .
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 .
[read-only]
sourceState
:
QState
* const
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 () | [见下文注意事项] |
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。
[bindable]
transitionType
:
TransitionType
注意: 此特性支持 QProperty 绑定。
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.
Constructs a new QAbstractTransition object with the given sourceState .
[virtual noexcept]
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 ().
[private signal]
void
QAbstractTransition::
targetStateChanged
()
此信号发射当 targetState 特性改变。
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。
注意: 通知程序信号对于特性 targetState .
另请参阅 QAbstractTransition::targetState .
Returns the target states of this transition, or an empty list if this transition has no target states.
注意: Getter function for property targetStates.
另请参阅 setTargetStates ().
[private signal]
void
QAbstractTransition::
targetStatesChanged
()
此信号发射当 targetStates 特性改变。
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。
注意: 通知程序信号对于特性 targetStates .
另请参阅 QAbstractTransition::targetStates .
Returns the type of the transition.
注意: Getter function for property transitionType.
另请参阅 setTransitionType ().
[private signal]
void
QAbstractTransition::
triggered
()
This signal is emitted when the transition has been triggered (after onTransition () has been called).
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。