CopperSpice API  1.9.2
QSignalTransition Class Reference

The QSignalTransition class provides a transition based on a signal. More...

Inheritance diagram for QSignalTransition:
QAbstractTransition QObject

Public Methods

template<class SignalClass , class... SignalArgs>
 QSignalTransition (QObject *sender, void (SignalClass::*signal)(SignalArgs...), QState *sourceState=nullptr)
 
 QSignalTransition (QState *sourceState=nullptr)
 
 ~QSignalTransition ()
 
const QObjectsenderObject () const
 
void setSenderObject (const QObject *sender)
 
- 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

 senderObject
 
- 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 QSignalTransition class provides a transition based on a CopperSpice signal.

Typically you would use the overload of QState::addTransition() that takes a sender and signal as arguments, rather than creating QSignalTransition objects directly. QSignalTransition is part of the State Machine.

You can subclass QSignalTransition and reimplement eventTest() to make a signal transition conditional; the event object passed to eventTest() will be a QStateMachine::SignalEvent object.

class CheckedTransition : public QSignalTransition {
public:
CheckedTransition(QCheckBox *check)
: QSignalTransition(check, SIGNAL(stateChanged(int))) {}
protected:
bool eventTest(QEvent *e) {
return false;
}
return (se->arguments().at(0).toInt() == Qt::Checked);
}
};
// ...
QCheckBox *check = new QCheckBox();
check->setTristate(true);
QState *s1 = new QState();
QState *s2 = new QState();
CheckedTransition *t1 = new CheckedTransition(check);
t1->setTargetState(s2);
s1->addTransition(t1);

Constructor & Destructor Documentation

QSignalTransition::QSignalTransition ( QState sourceState = nullptr)

Constructs a new signal transition with the given sourceState.

template<class SignalClass , class... SignalArgs>
QSignalTransition::QSignalTransition ( QObject sender,
void (SignalClass::*)(SignalArgs...)  signal,
QState sourceState = nullptr 
)

Constructs a new signal transition associated with the given signal of the given sender and with the given sourceState.

QSignalTransition::~QSignalTransition ( )

Destroys this signal transition.

Method Documentation

bool QSignalTransition::event ( QEvent event)
overrideprotectedvirtual

Reimplemented from QAbstractTransition::event()

bool QSignalTransition::eventTest ( QEvent event)
overrideprotectedvirtual

The default implementation returns true if the event is a QStateMachine::SignalEvent object and the event's sender and signal index match this transition, and returns false otherwise.

Implements QAbstractTransition::eventTest()

void QSignalTransition::onTransition ( QEvent event)
overrideprotectedvirtual
const QObject * QSignalTransition::senderObject ( ) const

Returns the value of the property senderObject associated with this signal transition.

See also
setSenderObject()
void QSignalTransition::setSenderObject ( const QObject sender)

Sets the property senderObject associated with this signal transition to sender.

See also
senderObject()

Property Documentation

QSignalTransition::senderObject

This property holds the sender object that this signal transition is associated with.

PropertiesClass Methods
read senderObject
write setSenderObject
notify senderObjectChanged