A simple state machine to use with Qt