Qt is provided with a powerful hierchical finite state machine through the Qt State Machine classes. Documentation for these examples can be found via the Examples link in the main Qt documentation.