![]() |
Home |
The QtSignalTransition class provides a transition based on a Qt signal. More...
#include <QtSignalTransition>
Inherits QtTransition.
The QtSignalTransition class provides a transition based on a Qt signal.
Typically you would use the overload of QtState::addTransition() that takes a sender and signal as arguments, rather than creating QtSignalTransition objects directly. QtSignalTransition is part of The State Machine Framework.
You can subclass QtSignalTransition and reimplement eventTest() to make a signal transition conditional; the event object passed to eventTest() will be a QtSignalEvent object. Example:
class CheckedTransition : public QtSignalTransition { public: CheckedTransition(QCheckBox *check) : QtSignalTransition(check, SIGNAL(stateChanged(int))) {} protected: bool eventTest(QEvent *e) const { if (!QtSignalTransition::eventTest(e)) return false; QtSignalEvent *se = static_cast<QtSignalEvent*>(e); return (se->arguments().at(0).toInt() == Qt::Checked); } }; ... QCheckBox *check = new QCheckBox(); check->setTristate(true); QtState *s1 = new QtState(); QtState *s2 = new QtState(); 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:
This property holds the signal that this signal transition is associated with.
Access functions:
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.
Constructs a new signal transition associated with the given signal of the given sender. The transition has the given targets and sourceState.
Destroys this signal transition.
Copyright © 2009 Nokia | Trademarks | Qt Solutions |