QSignalTransition¶
The
QSignalTransition
class provides a transition based on a Qt signal. More…
New in version 4.6.
Synopsis¶
Functions¶
def
senderObject
()def
setSenderObject
(sender)def
setSignal
(signal)def
signal
()
Detailed Description¶
Typically you would use the overload of
addTransition()
that takes a sender and signal as arguments, rather than creatingQSignalTransition
objects directly.QSignalTransition
is part of The State Machine Framework .You can subclass
QSignalTransition
and reimplementeventTest()
to make a signal transition conditional; the event object passed toeventTest()
will be aSignalEvent
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])¶ Constructs a new signal transition with the given
sourceState
.Constructs a new signal transition associated with the given
signal
of the givensender
, and with the givensourceState
.
-
PySide2.QtCore.QSignalTransition.
senderObject
()¶ - Return type
Returns the sender object associated with this signal transition.
See also
-
PySide2.QtCore.QSignalTransition.
setSenderObject
(sender)¶ - Parameters
sender –
QObject
Sets the
sender
object associated with this signal transition.See also
-
PySide2.QtCore.QSignalTransition.
setSignal
(signal)¶ - Parameters
signal –
QByteArray
Sets the
signal
associated with this signal transition.See also
-
PySide2.QtCore.QSignalTransition.
signal
()¶ - Return type
Returns the signal associated with this signal transition.
See also
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.