Important: Please read the Qt Code of Conduct -

Screen slide animation with states and transitions, setting a default transition

  • Hey,

    I have an app with several screens, which each have an associated state. Now I want to have a slide animation between screens.

    It is actually not that difficult, I do it like this:

    states: [
        State {
            name: "start"
        State {
            name: "login"
    transitions: [
        SlideLeftTransition {
            from: "start"
            to: "login"
            inTarget: loginscreen
            outTarget: startscreen

    SlideLeftTransition is the transition taking care of sliding the screens. Now if I have 10 screens, I would need to define 9+8+7+6+5+4+3+2+1=45 transitions.

    So I want to define a default transition!

    SlideLeftTransition {
            inTarget: screen_of_old_state
            outTarget: screen_of_new_state

    But I am missing 2 ingridients:

    1. I have to associate a state with a screen, in a way that I can access the screen from a generic transition.
    2. I have to know from which state/screen I am coming.

    How can this be done?


Log in to reply