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  · 

QHistoryState Class

The QHistoryState class provides a means of returning to a previously active substate. More...

 #include <QHistoryState>

Inherits: QAbstractState.

This class was introduced in Qt 4.6.

Public Types

enum HistoryType { ShallowHistory, DeepHistory }

Properties

  • 1 property inherited from QObject

Public Functions

QHistoryState(QState * parent = 0)
QHistoryState(HistoryType type, QState * parent = 0)
~QAbstractState()
~QHistoryState()
QAbstractState * defaultState() const
HistoryType historyType() const
QStateMachine * machine() const
QState * parentState() const
void setDefaultState(QAbstractState * state)
void setHistoryType(HistoryType type)
  • 31 public functions inherited from QObject

Signals

void entered()
void exited()

Protected Functions

QAbstractState(QState * parent = 0)
virtual bool event(QEvent * e)
virtual void onEntry(QEvent * event) = 0
virtual void onExit(QEvent * event) = 0

Reimplemented Protected Functions

virtual bool event(QEvent * e)
virtual void onEntry(QEvent * event)
virtual void onExit(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 QHistoryState class provides a means of returning to a previously active substate.

A history state is a pseudo-state that represents the child state that the parent state was in the last time the parent state was exited. A transition with a history state as its target is in fact a transition to one of the other child states of the parent state. QHistoryState is part of The State Machine Framework.

Use the setDefaultState() function to set the state that should be entered if the parent state has never been entered. Example:

 QStateMachine machine;

 QState *s1 = new QState();
 QState *s11 = new QState(s1);
 QState *s12 = new QState(s1);

 QHistoryState *s1h = new QHistoryState(s1);
 s1h->setDefaultState(s11);

 machine.addState(s1);

 QState *s2 = new QState();
 machine.addState(s2);

 QPushButton *button = new QPushButton();
 // Clicking the button will cause the state machine to enter the child state
 // that s1 was in the last time s1 was exited, or the history state's default
 // state if s1 has never been entered.
 s1->addTransition(button, SIGNAL(clicked()), s1h);

By default a history state is shallow, meaning that it won't remember nested states. This can be configured through the historyType property.

Member Type Documentation

enum QHistoryState::HistoryType

This enum specifies the type of history that a QHistoryState records.

ConstantValueDescription
QHistoryState::ShallowHistory0Only the immediate child states of the parent state are recorded. In this case a transition with the history state as its target will end up in the immediate child state that the parent was in the last time it was exited. This is the default.
QHistoryState::DeepHistory1Nested states are recorded. In this case a transition with the history state as its target will end up in the most deeply nested descendant state the parent was in the last time it was exited.

Property Documentation

defaultState : QAbstractState *

This property holds the default state of this history state.

Access functions:

QAbstractState * defaultState() const
void setDefaultState(QAbstractState * state)

historyType : HistoryType

This property holds the type of history that this history state records.

The default value of this property is QHistoryState::ShallowHistory.

Access functions:

HistoryType historyType() const
void setHistoryType(HistoryType type)

Member Function Documentation

QHistoryState::QHistoryState(QState * parent = 0)

Constructs a new shallow history state with the given parent state.

QHistoryState::QHistoryState(HistoryType type, QState * parent = 0)

Constructs a new history state of the given type, with the given parent state.

QHistoryState::~QHistoryState()

Destroys this history state.

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

Reimplemented from QObject::event().

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

Reimplemented from QAbstractState::onEntry().

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

Reimplemented from QAbstractState::onExit().

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