Search code examples
qtqmlqtquick2qt-quick

What's the difference between QtQuick.State and QtQml.StateMachine.State?


Qt Quick has two flavors of state machines. One is part of Qt Quick States; it looks like it's focused on animation. The second is part of the Declarative State Machine Framework, and in turn looks to be more for general state machine logic.

That said, I could be missing the point entirely. So my question is this: Why would I want to use Qt Quick States over the Declarative State Machine Framework, or vice versa?


Solution

  • Qt Quick states are just sets of property configurations of items. They are not a means of specifying state machines.

    The State Machine Framework, whether used through its declarative interface or from Qt, implements most of the UML Statechart.

    Both Qt Quick States and the State Machine Framework can coexist. In fact, it might be beneficial to combine them: use the Qt Quick states to describe the configurations, then a statechart to switch between Qt Quick states.