Home

QtSignalTransition Class Reference
[QtCore module]

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

 #include <QtSignalTransition>

Inherits QtTransition.

This class was introduced in qtstatemachine 4.6.

Properties

Public Functions

Additional Inherited Members


Detailed Description

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);

Property Documentation

object : QObject *

This property holds the sender object that this signal transition is associated with.

Access functions:

signal : QByteArray

This property holds the signal that this signal transition is associated with.

Access functions:


Member Function Documentation

QtSignalTransition::QtSignalTransition ( QtState * sourceState = 0 )

Constructs a new signal transition with the given sourceState.

QtSignalTransition::QtSignalTransition ( QObject * sender, const char * signal, QtState * sourceState = 0 )

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

QtSignalTransition::QtSignalTransition ( QObject * sender, const char * signal, const QList<QtAbstractState *> & targets, QtState * sourceState = 0 )

Constructs a new signal transition associated with the given signal of the given sender. The transition has the given targets and sourceState.

QtSignalTransition::~QtSignalTransition ()

Destroys this signal transition.


Copyright © 2009 Nokia Trademarks
Qt Solutions