QFinalState Class Reference

The QFinalState class provides a final state.

  1. #include <QFinalState>

Inherits: QAbstractState.

This class was introduced in Qt 4.6.

Detailed Description

The QFinalState class provides a final state.

A final state is used to communicate that (part of) a QStateMachine has finished its work. When a final top-level state is entered, the state machine's finished() signal is emitted. In general, when a final substate (a child of a QState) is entered, the parent state's finished() signal is emitted. QFinalState is part of The State Machine Framework.

To use a final state, you create a QFinalState object and add a transition to it from another state. Example:

  1.                 QPushButton button;
  2.  
  3. QStateMachine machine;
  4. QState *s1 = new QState();
  5. QFinalState *s2 = new QFinalState();
  6. s1->addTransition(&button, SIGNAL(clicked()), s2);
  7. machine.addState(s1);
  8. machine.addState(s2);
  9.  
  10. QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
  11. machine.setInitialState(s1);
  12. machine.start();

See also QStateMachine::finished() and QState::finished().

Public Functions

Toggle details QFinalState

QFinalStateQFinalState ( QState *parent=0 ) ( QState *parent=0 )

Constructs a new QFinalState object with the given parent state.

Look up this member in the source code.

Toggle details QFinalState

~QFinalState~QFinalState () ()

Destroys this final state.

Look up this member in the source code.

Toggle details bool QFinalState

eventevent ( QEvent *e ) ( QEvent *e ) [virtual protected]

Reimplemented from QObject::event().

Look up this member in the source code.

Toggle details void QFinalState

onEntryonEntry ( QEvent *event ) ( QEvent *event ) [virtual protected]

Reimplemented from QAbstractState::onEntry().

Look up this member in the source code.

Toggle details void QFinalState

onExitonExit ( QEvent *event ) ( QEvent *event ) [virtual protected]

Reimplemented from QAbstractState::onExit().

Look up this member in the source code.

    Notes provided by the Qt Community

    No notes