内容表

上一话题

QEventLoop

下一话题

QFactoryInterface

QEventTransition

QEventTransition 类提供 QObject 特定过渡为 Qt 事件。 更多

Inheritance diagram of PySide2.QtCore.QEventTransition

继承者: QKeyEventTransition , QMouseEventTransition

4.6 版新增。

概要

函数

详细描述

A QEventTransition object binds an event to a particular QObject . QEventTransition is part of 状态机框架 .

范例:

QPushButton *button = ...;
QState *s1 = ...;
QState *s2 = ...;
// If in s1 and the button receives an Enter event, transition to s2
QEventTransition *enterTransition = new QEventTransition(button, QEvent::Enter);
enterTransition->setTargetState(s2);
s1->addTransition(enterTransition);
// If in s2 and the button receives an Exit event, transition back to s1
QEventTransition *leaveTransition = new QEventTransition(button, QEvent::Leave);
leaveTransition->setTargetState(s1);
s2->addTransition(leaveTransition);
											

子类化

When reimplementing the eventTest() function, you should first call the base implementation to verify that the event is a WrappedEvent for the proper object and event type. You may then cast the event to a WrappedEvent and get the original event by calling event() , and perform additional checks on that object.

另请参阅

addTransition()

class QEventTransition ( object , type [ , sourceState=None ] )

QEventTransition([sourceState=None])

param type

Type

param sourceState

QState

param object

QObject

构造新 QEventTransition object associated with events of the given type 为给定 object ,和采用给定 sourceState .

构造新 QEventTransition 对象采用给定 sourceState .

PySide2.QtCore.QEventTransition. eventSource ( )
返回类型

QObject

Returns the event source associated with this event transition.

另请参阅

setEventSource()

PySide2.QtCore.QEventTransition. eventType ( )
返回类型

Type

Returns the event type that this event transition is associated with.

另请参阅

setEventType()

PySide2.QtCore.QEventTransition. setEventSource ( object )
参数

object QObject

Sets the event source associated with this event transition to be the given object .

另请参阅

eventSource()

PySide2.QtCore.QEventTransition. setEventType ( type )
参数

type Type

Sets the event type that this event transition is associated with.

另请参阅

eventType()