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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QState Class Reference
[QtCore module]

The QState class provides a general-purpose state for QStateMachine. More...

 #include <QState>

Inherits QAbstractState.

Inherited by QStateMachine.

This class was introduced in Qt 4.6.


Public Types

enum ChildMode { ExclusiveStates, ParallelStates }

Properties

  • 1 property inherited from QObject

Public Functions

QState ( QState * parent = 0 )
QState ( ChildMode childMode, QState * parent = 0 )
~QState ()
void addTransition ( QAbstractTransition * transition )
QSignalTransition * addTransition ( QObject * sender, const char * signal, QAbstractState * target )
QAbstractTransition * addTransition ( QAbstractState * target )
void assignProperty ( QObject * object, const char * name, const QVariant & value )
ChildMode childMode () const
QAbstractState * errorState () const
QAbstractState * initialState () const
void removeTransition ( QAbstractTransition * transition )
void setChildMode ( ChildMode mode )
void setErrorState ( QAbstractState * state )
void setInitialState ( QAbstractState * state )

Signals

void finished ()
void propertiesAssigned ()

Reimplemented Protected Functions

virtual bool event ( QEvent * e )
virtual void onEntry ( QEvent * event )
virtual void onExit ( QEvent * event )

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 5 static public members inherited from QObject
  • 3 protected functions inherited from QAbstractState
  • 7 protected functions inherited from QObject

Detailed Description

The QState class provides a general-purpose state for QStateMachine.

QState objects can have child states, and can have transitions to other states. QState is part of The State Machine Framework.

The addTransition() function adds a transition. The removeTransition() function removes a transition.

The assignProperty() function is used for defining property assignments that should be performed when a state is entered.

Top-level states must be passed a QStateMachine object as their parent state, or added to a state machine using QStateMachine::addState().

States with Child States

The childMode property determines how child states are treated. For non-parallel state groups, the setInitialState() function must be called to set the initial state. The child states are mutually exclusive states, and the state machine needs to know which child state to enter when the parent state is the target of a transition.

The state emits the QState::finished() signal when a final child state (QFinalState) is entered.

The setErrorState() sets the state's error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set).


Member Type Documentation

enum QState::ChildMode

This enum specifies how a state's child states are treated.

ConstantValueDescription
QState::ExclusiveStates0The child states are mutually exclusive and an initial state must be set by calling QState::setInitialState().
QState::ParallelStates1The child states are parallel. When the parent state is entered, all its child states are entered in parallel.


Property Documentation

childMode : ChildMode

This property holds the child mode of this state.

The default value of this property is QState::ExclusiveStates.

Access functions:

ChildMode childMode () const
void setChildMode ( ChildMode mode )

errorState : QAbstractState *

This property holds the error state of this state.

Access functions:

QAbstractState * errorState () const
void setErrorState ( QAbstractState * state )

initialState : QAbstractState *

This property holds the initial state of this state (one of its child states).

Access functions:

QAbstractState * initialState () const
void setInitialState ( QAbstractState * state )

Member Function Documentation

QState::QState ( QState * parent = 0 )

Constructs a new state with the given parent state.

QState::QState ( ChildMode childMode, QState * parent = 0 )

Constructs a new state with the given childMode and the given parent state.

QState::~QState ()

Destroys this state.

void QState::addTransition ( QAbstractTransition * transition )

Adds the given transition. The transition has this state as the source. This state takes ownership of the transition.

QSignalTransition * QState::addTransition ( QObject * sender, const char * signal, QAbstractState * target )

Adds a transition associated with the given signal of the given sender object, and returns the new QSignalTransition object. The transition has this state as the source, and the given target as the target state.

QAbstractTransition * QState::addTransition ( QAbstractState * target )

Adds an unconditional transition from this state to the given target state, and returns then new transition object.

void QState::assignProperty ( QObject * object, const char * name, const QVariant & value )

Instructs this state to set the property with the given name of the given object to the given value when the state is entered.

See also propertiesAssigned().

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

Reimplemented from QObject::event().

void QState::finished ()   [signal]

This signal is emitted when a final child state of this state is entered.

See also QFinalState.

void QState::onEntry ( QEvent * event )   [virtual protected]

Reimplemented from QAbstractState::onEntry().

void QState::onExit ( QEvent * event )   [virtual protected]

Reimplemented from QAbstractState::onExit().

void QState::propertiesAssigned ()   [signal]

This signal is emitted when all properties have been assigned their final value. If the state assigns a value to one or more properties for which an animation exists (either set on the transition or as a default animation on the state machine), then the signal will not be emitted until all such animations have finished playing.

If there are no relevant animations, or no property assignments defined for the state, then the signal will be emitted immediately before the state is entered.

See also QState::assignProperty() and QAbstractTransition::addAnimation().

void QState::removeTransition ( QAbstractTransition * transition )

Removes the given transition from this state. The state releases ownership of the transition.

See also addTransition().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 17
  4. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
Page suivante

Le Qt Labs au hasard

Logo

QMake et au-delà

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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 4.6
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