I am having trouble understanding what you want, however I think QStateMachine might not be a good solution to your problem. I don't see any benefit of tracking the mouse state using an external state machine. I think it would be much easier to have a flag for marking the current mode and invoking code based on current mode from within mouse event handler methods. Of course you could make a state machine for it (and I'd suggest to make it a hierarchical one) but it will not make your code cleaner or better, it will just require your time to implement it.