
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQSignalTransition class provides a transition based on a Qt signal.More...
| Header: | #include <QSignalTransition> |
| Since: | Qt 4.6 |
| Inherits: | QAbstractTransition |
| QSignalTransition(QState * sourceState = 0) | |
| QSignalTransition(QObject * sender, const char * signal, QState * sourceState = 0) | |
| ~QSignalTransition() | |
| QObject * | senderObject() const |
| void | setSenderObject(QObject * sender) |
| void | setSignal(const QByteArray & signal) |
| QByteArray | signal() const |
| virtual bool | event(QEvent * e) |
| virtual bool | eventTest(QEvent * event) |
| virtual void | onTransition(QEvent * event) |
TheQSignalTransition class provides a transition based on a Qt signal.
Typically you would use the overload ofQState::addTransition() that takes a sender and signal as arguments, rather than creatingQSignalTransition objects directly.QSignalTransition is part ofThe State Machine Framework.
You can subclassQSignalTransition and reimplementeventTest() to make a signal transition conditional; the event object passed toeventTest() will be aQStateMachine::SignalEvent object. Example:
class CheckedTransition :publicQSignalTransition{public: CheckedTransition(QCheckBox*check) :QSignalTransition(check, SIGNAL(stateChanged(int))) {}protected: bool eventTest(QEvent*e) {if (!QSignalTransition::eventTest(e))returnfalse;QStateMachine::SignalEvent*se=static_cast<QStateMachine::SignalEvent*>(e);return (se->arguments().at(0).toInt()==Qt::Checked); }};...QCheckBox*check=newQCheckBox();check->setTristate(true);QState*s1=newQState();QState*s2=newQState();CheckedTransition*t1=new CheckedTransition(check);t1->setTargetState(s2);s1->addTransition(t1);
This property holds the sender object that this signal transition is associated with.
Access functions:
| QObject * | senderObject() const |
| void | setSenderObject(QObject * sender) |
This property holds the signal that this signal transition is associated with.
Access functions:
| QByteArray | signal() const |
| void | setSignal(const QByteArray & signal) |
Constructs a new signal transition with the givensourceState.
Constructs a new signal transition associated with the givensignal of the givensender, and with the givensourceState.
Destroys this signal transition.
[virtual protected]bool QSignalTransition::event(QEvent * e)Reimplemented fromQObject::event().
[virtual protected]bool QSignalTransition::eventTest(QEvent * event)Reimplemented fromQAbstractTransition::eventTest().
The default implementation returns true if theevent is aQStateMachine::SignalEvent object and the event's sender and signal index match this transition, and returns false otherwise.
[virtual protected]void QSignalTransition::onTransition(QEvent * event)Reimplemented fromQAbstractTransition::onTransition().
© 2016 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 theGNU 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.