PySide6.QtStateMachine.QSignalTransition¶
- class QSignalTransition¶
- The - QSignalTransitionclass provides a transition based on a Qt signal.- Details- Typically you would use the overload of - addTransition()that takes a sender and signal as arguments, rather than creating- QSignalTransitionobjects directly.- QSignalTransitionis part of Qt State Machine Framework .- You can subclass - QSignalTransitionand reimplement- eventTest()to make a signal transition conditional; the event object passed to- eventTest()will be a- SignalEventobject. Example:- class CheckedTransition : public QSignalTransition { public: CheckedTransition(QCheckBox *check) : QSignalTransition(check, SIGNAL(stateChanged(int))) {} protected: bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); 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);- Synopsis¶- Properties¶- senderObjectᅟ- The sender object that this signal transition is associated with
- signalᅟ- The signal that this signal transition is associated with
 - Methods¶- def - __init__()
- def - senderObject()
- def - setSignal()
- def - signal()
 - Signals¶
- def - signalChanged()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- This property holds the sender object that this signal transition is associated with. - Access functions:
 - property signalᅟ: QByteArray¶
 - This property holds the signal that this signal transition is associated with. - Access functions:
- Signal - signalChanged()
 
 - Constructs a new signal transition with the given - sourceState.- __init__(signal[, state=None])
- Parameters:
- signal – object 
- state – - QState
 
 
 - __init__(sender, signal[, sourceState=None])
 - Constructs a new signal transition associated with the given - signalof the given- sender, and with the given- sourceState.- Returns the sender object associated with this signal transition. - See also - Getter of property - senderObjectᅟ.- senderObjectChanged()¶
 - This signal is emitted when the - senderObjectproperty is changed.- See also - Notification signal of property - senderObjectᅟ.- Sets the - senderobject associated with this signal transition.- See also - Setter of property - senderObjectᅟ.- setSignal(signal)¶
- Parameters:
- signal – - QByteArray
 
 - Sets the - signalassociated with this signal transition.- See also - Setter of property - signalᅟ.- signal()¶
- Return type:
 
 - Returns the signal associated with this signal transition. - See also - Getter of property - signalᅟ.- signalChanged()¶
 - This signal is emitted when the signal property is changed. - See also - Notification signal of property - signalᅟ.