CopperSpice API  1.9.1
QEventTransition Class Reference

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

Inheritance diagram for QEventTransition:
QAbstractTransition QObject QKeyEventTransition QMouseEventTransition

Public Methods

 QEventTransition (QObject *object, QEvent::Type type, QState *sourceState=nullptr)
 
 QEventTransition (QState *sourceState=nullptr)
 
 ~QEventTransition ()
 
QObjecteventSource () const
 
QEvent::Type eventType () const
 
void setEventSource (QObject *object)
 
void setEventType (QEvent::Type type)
 
- Public Methods inherited from QAbstractTransition
 QAbstractTransition (QState *sourceState=nullptr)
 
virtual ~QAbstractTransition ()
 
void addAnimation (QAbstractAnimation *animation)
 
QList< QAbstractAnimation * > animations () const
 
QStateMachinemachine () const
 
void removeAnimation (QAbstractAnimation *animation)
 
void setTargetState (QAbstractState *target)
 
void setTargetStates (const QList< QAbstractState * > &targets)
 
void setTransitionType (TransitionType type)
 
QStatesourceState () const
 
QAbstractStatetargetState () const
 
QList< QAbstractState * > targetStates () const
 
TransitionType transitionType () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Protected Methods

bool event (QEvent *event) override
 
bool eventTest (QEvent *event) override
 
void onTransition (QEvent *event) override
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Properties

 eventSource
 
 eventType
 
- Properties inherited from QAbstractTransition
 sourceState
 
 targetState
 
 targetStates
 
 transitionType
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Types inherited from QAbstractTransition
enum  TransitionType
 
- Public Signals inherited from QAbstractTransition
void targetStateChanged ()
 
void targetStatesChanged ()
 
void triggered ()
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Detailed Description

The QEventTransition class provides a QObject specific transition for events. A QEventTransition object binds an event to a particular QObject. QEventTransition is part of State Machine.

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 eventTest() you should first call the base implementation to verify the event is a QStateMachine::WrappedEvent for the proper object and event type. Then cast the event to a QStateMachine::WrappedEvent and get the original event by calling QStateMachine::WrappedEvent::event() and perform additional checks on that object.

See also
QState::addTransition()

Constructor & Destructor Documentation

QEventTransition::QEventTransition ( QState sourceState = nullptr)

Constructs a new QEventTransition object with the given sourceState.

QEventTransition::QEventTransition ( QObject object,
QEvent::Type  type,
QState sourceState = nullptr 
)

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

QEventTransition::~QEventTransition ( )

Destroys this QObject event transition.

Method Documentation

bool QEventTransition::event ( QEvent event)
overrideprotectedvirtual

Reimplemented from QAbstractTransition::event()

QObject * QEventTransition::eventSource ( ) const

Returns the value of the property eventSource associated with this event transition.

See also
setEventSource()
bool QEventTransition::eventTest ( QEvent event)
overrideprotectedvirtual
QEvent::Type QEventTransition::eventType ( ) const

Returns the value of the property eventType associated with this event transition.

See also
setEventType()
void QEventTransition::onTransition ( QEvent event)
overrideprotectedvirtual
void QEventTransition::setEventSource ( QObject object)

Sets the property eventSource associated with this event transition to the given object.

See also
eventSource()
void QEventTransition::setEventType ( QEvent::Type  type)

Sets the property eventType associated with this event transition to the given type.

See also
eventType()

Property Documentation

QEventTransition::eventSource

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

PropertiesClass Methods
read eventSource
write setEventSource
QEventTransition::eventType

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

PropertiesClass Methods
read eventType
write setEventType