CopperSpice API  1.9.1
QAbstractTransition Class Referenceabstract

Base class of transitions between QAbstractState objects. More...

Inheritance diagram for QAbstractTransition:
QObject QEventTransition QSignalTransition QKeyEventTransition QMouseEventTransition

Public Types

enum  TransitionType
 

Public Signals

void targetStateChanged ()
 
void targetStatesChanged ()
 
void triggered ()
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Methods

 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
 
virtual bool eventTest (QEvent *event) = 0
 
virtual void onTransition (QEvent *event) = 0
 
- 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

 sourceState
 
 targetState
 
 targetStates
 
 transitionType
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- 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 QAbstractTransition class is the abstract base class of transitions between states (QAbstractState objects) of a QStateMachine. QAbstractTransition is part of State Machine.

The sourceState() method returns the source of the transition. The targetStates() method returns the targets of the transition. The machine() function returns the state machine that the transition is part of. The triggered() signal is emitted when the transition has been triggered.

Transitions can cause animations to be played. Use addAnimation() to add an animation to the transition.

Subclassing

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.

See also
removeAnimation(), animations()

Member Enumeration Documentation

This enum specifies the kind of transition. By default the type is an external transition.

ConstantValueDescription
QAbstractTransition::ExternalTransition0 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::InternalTransition1 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.
See also
QAbstractTransition::transitionType

Constructor & Destructor Documentation

QAbstractTransition::QAbstractTransition ( QState sourceState = nullptr)

Constructs a new QAbstractTransition object with the given sourceState.

QAbstractTransition::~QAbstractTransition ( )
virtual

Destroys this transition.

Method Documentation

void QAbstractTransition::addAnimation ( QAbstractAnimation animation)

Adds the given animation to this transition. The transition does not take ownership of the animation.

See also
removeAnimation(), animations()
QList< QAbstractAnimation * > QAbstractTransition::animations ( ) const

Returns the list of animations associated with this transition, or an empty list if it has no animations.

See also
addAnimation()
bool QAbstractTransition::event ( QEvent event)
overrideprotectedvirtual
bool QAbstractTransition::eventTest ( QEvent event)
protectedpure virtual

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.

Implemented in QSignalTransition::eventTest(), QMouseEventTransition::eventTest(), QEventTransition::eventTest(), QKeyEventTransition::eventTest()

QStateMachine * QAbstractTransition::machine ( ) const

Returns the state machine this transition is part of or a nullptr if the transition is not part of a state machine.

void QAbstractTransition::onTransition ( QEvent event)
protectedpure virtual

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.

Implemented in QSignalTransition::onTransition(), QMouseEventTransition::onTransition(), QEventTransition::onTransition(), QKeyEventTransition::onTransition()

void QAbstractTransition::removeAnimation ( QAbstractAnimation animation)

Removes the given animation from this transition.

See also
addAnimation()
void QAbstractTransition::setTargetState ( QAbstractState target)

Sets the property for targetState of this transition to target.

void QAbstractTransition::setTargetStates ( const QList< QAbstractState * > &  targets)

Sets the property for targetStates of this transition to the given targets.

void QAbstractTransition::setTransitionType ( QAbstractTransition::TransitionType  type)

Sets the type of the transition to type.

See also
transitionType()
QState * QAbstractTransition::sourceState ( ) const

Returns the value of the property sourceState. Returns nullptr if this transition has no source state.

QAbstractState * QAbstractTransition::targetState ( ) const

Returns the value of the property targetState. Returns a nullptr if this transition has no target.

void QAbstractTransition::targetStateChanged ( )
signal

This signal is emitted when the targetState property is changed.

See also
QAbstractTransition::targetState
QList< QAbstractState * > QAbstractTransition::targetStates ( ) const

Returns the value of the property targetStates of this transition. Value an empty list if this transition has no target states.

void QAbstractTransition::targetStatesChanged ( )
signal

This signal is emitted when the targetStates property is changed.

See also
QAbstractTransition::targetStates
QAbstractTransition::TransitionType QAbstractTransition::transitionType ( ) const

Returns the type of the transition.

See also
setTransitionType()
void QAbstractTransition::triggered ( )
signal

This signal is emitted when the transition has been triggered (after onTransition() has been called).

Property Documentation

QAbstractTransition::sourceState

This property holds the source state (parent) of this transition.

PropertiesClass Methods
read sourceState
QAbstractTransition::targetState

This property holds the target state of this transition.

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

PropertiesClass Methods
read targetState
write setTargetState
notify targetStateChanged
QAbstractTransition::targetStates

This property holds the target states of this transition. If multiple states are specified, all must be descendants of the same parallel group state.

PropertiesClass Methods
read targetStates
write setTargetStates
notify targetStatesChanged
QAbstractTransition::transitionType

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.

PropertiesClass Methods
read transitionType
write setTransitionType
revision