QSignalTransition

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

Inheritance diagram of PySide2.QtCore.QSignalTransition

New in version 4.6.

Synopsis

Functions

Detailed Description

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

You can subclass QSignalTransition and reimplement eventTest() to make a signal transition conditional; the event object passed to eventTest() will be a SignalEvent object. 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);
class QSignalTransition(arg__1[, arg__2=None])

QSignalTransition([sourceState=None])

QSignalTransition(sender, signal[, sourceState=None])

param sourceState

QState

param signal

str

param arg__1

PyObject

param arg__2

QState

param sender

QObject

Constructs a new signal transition with the given sourceState .

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

PySide2.QtCore.QSignalTransition.senderObject()
Return type

QObject

Returns the sender object associated with this signal transition.

PySide2.QtCore.QSignalTransition.setSenderObject(sender)
Parameters

senderQObject

Sets the sender object associated with this signal transition.

See also

senderObject()

PySide2.QtCore.QSignalTransition.setSignal(signal)
Parameters

signalQByteArray

Sets the signal associated with this signal transition.

See also

signal()

PySide2.QtCore.QSignalTransition.signal()
Return type

QByteArray

Returns the signal associated with this signal transition.

See also

setSignal()