QEventTransition

The QEventTransition class provides a QObject -specific transition for Qt events. More

Inheritance diagram of PySide2.QtCore.QEventTransition

Inherited by: QKeyEventTransition, QMouseEventTransition

New in version 4.6.

Synopsis

Functions

Detailed Description

A QEventTransition object binds an event to a particular QObject . QEventTransition is part of The State Machine Framework .

Example:

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

Subclassing

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.

See also

addTransition()

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

PySide2.QtCore.QEventTransition([sourceState=None])

param type

Type

param sourceState

PySide2.QtCore.QState

param object

PySide2.QtCore.QObject

Constructs a new QEventTransition object associated with events of the given type for the given object , and with the given sourceState .

Constructs a new QEventTransition object with the given sourceState .

PySide2.QtCore.QEventTransition.eventSource()
Return type

PySide2.QtCore.QObject

This property holds the event source that this event transition is associated with.

PySide2.QtCore.QEventTransition.eventType()
Return type

Type

This property holds the type of event that this event transition is associated with.

PySide2.QtCore.QEventTransition.setEventSource(object)
Parameters

objectPySide2.QtCore.QObject

This property holds the event source that this event transition is associated with.

PySide2.QtCore.QEventTransition.setEventType(type)
Parameters

typeType

This property holds the type of event that this event transition is associated with.