Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QSignalTransition Class

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

 #include <QSignalTransition>

Inherits: QAbstractTransition.

This class was introduced in Qt 4.6.

Properties

  • 1 property inherited from QObject

Public Functions

QAbstractTransition(QState * sourceState = 0)
QSignalTransition(QState * sourceState = 0)
QSignalTransition(QObject * sender, const char * signal, QState * sourceState = 0)
virtual ~QAbstractTransition()
~QSignalTransition()
void addAnimation(QAbstractAnimation * animation)
QList<QAbstractAnimation *> animations() const
QStateMachine * machine() const
void removeAnimation(QAbstractAnimation * animation)
QObject * senderObject() const
void setSenderObject(QObject * sender)
void setSignal(const QByteArray & signal)
void setTargetState(QAbstractState * target)
void setTargetStates(const QList<QAbstractState *> & targets)
QByteArray signal() const
QState * sourceState() const
QAbstractState * targetState() const
QList<QAbstractState *> targetStates() const
  • 31 public functions inherited from QObject

Signals

void triggered()

Protected Functions

virtual bool event(QEvent * e)
virtual bool eventTest(QEvent * event) = 0
virtual void onTransition(QEvent * event) = 0

Reimplemented Protected Functions

virtual bool event(QEvent * e)
virtual bool eventTest(QEvent * event)
virtual void onTransition(QEvent * event)
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject

Detailed Description

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

Typically you would use the overload of QState::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 QStateMachine::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);

Property Documentation

senderObject : QObject *

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

Access functions:

QObject * senderObject() const
void setSenderObject(QObject * sender)

signal : QByteArray

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

Access functions:

QByteArray signal() const
void setSignal(const QByteArray & signal)

Member Function Documentation

QSignalTransition::QSignalTransition(QState * sourceState = 0)

Constructs a new signal transition with the given sourceState.

QSignalTransition::QSignalTransition(QObject * sender, const char * signal, QState * sourceState = 0)

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

QSignalTransition::~QSignalTransition()

Destroys this signal transition.

bool QSignalTransition::event(QEvent * e) [virtual protected]

Reimplemented from QObject::event().

bool QSignalTransition::eventTest(QEvent * event) [virtual protected]

Reimplemented from QAbstractTransition::eventTest().

The default implementation returns true if the event is a QStateMachine::SignalEvent object and the event's sender and signal index match this transition, and returns false otherwise.

void QSignalTransition::onTransition(QEvent * event) [virtual protected]

Reimplemented from QAbstractTransition::onTransition().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web