Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. State Transition Problem

State Transition Problem

Scheduled Pinned Locked Moved Mobile and Embedded
stateslidingtrasitioneasingloaderqml
4 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maxim DC
    wrote on 11 Jun 2015, 19:13 last edited by p3c0 6 Dec 2015, 05:53
    #1

    I have 2 states, page1 and page2, i want to make a sliding transition so page1 goes ofscreen and a the same time page2 comes in. I use a Loader Component and i don't now where to start. Here is my main code.

    ApplicationWindow {
        title: qsTr("Test3")
        width: Screen.desktopAvailableWidth
        height: Screen.desktopAvailableHeight
        visible: true
        Loader {
            id: pageLoader
            anchors.fill: parent
            source: "PageMain.qml"
            states: [
                State {
                    name: "MAIN"
                    PropertyChanges { target: pageLoader; source: "PageMain.qml"}
                },
                State {
                    name: "FAVORITES"
                    PropertyChanges { target: pageLoader; source: "PageFavorites.qml"}
                }
            ]
            transitions: [
                Transition {
                    to: "*"
                    // Transition
                }
            ]
        }
    }
    
    P 1 Reply Last reply 12 Jun 2015, 05:51
    0
    • M Maxim DC
      11 Jun 2015, 19:13

      I have 2 states, page1 and page2, i want to make a sliding transition so page1 goes ofscreen and a the same time page2 comes in. I use a Loader Component and i don't now where to start. Here is my main code.

      ApplicationWindow {
          title: qsTr("Test3")
          width: Screen.desktopAvailableWidth
          height: Screen.desktopAvailableHeight
          visible: true
          Loader {
              id: pageLoader
              anchors.fill: parent
              source: "PageMain.qml"
              states: [
                  State {
                      name: "MAIN"
                      PropertyChanges { target: pageLoader; source: "PageMain.qml"}
                  },
                  State {
                      name: "FAVORITES"
                      PropertyChanges { target: pageLoader; source: "PageFavorites.qml"}
                  }
              ]
              transitions: [
                  Transition {
                      to: "*"
                      // Transition
                  }
              ]
          }
      }
      
      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 12 Jun 2015, 05:51 last edited by
      #2

      Hi @Maxim-DC and Welcome,
      IMO, instead of using a Loader and loading QML's here for sliding purpose would be a bad idea. You may need to maintain a lot of States and Transitions.
      Instead I would suggest you to use StackView. To load and unload you just need to push and pop the QML files into it. And yes it provides transitions too. By default it will slide.
      If you don't want to use StackView then you can use a ListView with its delegate as a Loader which will load your QML files. Just change ListView's orientation to Qt.Horizontal. By incrementing and decrementing the currentIndex the items in the ListView will slide accordingly. Also just make sure the delegates size is filled to the screen size to get a feel similar to what you are trying.

      157

      M 1 Reply Last reply 12 Jun 2015, 11:12
      0
      • P p3c0
        12 Jun 2015, 05:51

        Hi @Maxim-DC and Welcome,
        IMO, instead of using a Loader and loading QML's here for sliding purpose would be a bad idea. You may need to maintain a lot of States and Transitions.
        Instead I would suggest you to use StackView. To load and unload you just need to push and pop the QML files into it. And yes it provides transitions too. By default it will slide.
        If you don't want to use StackView then you can use a ListView with its delegate as a Loader which will load your QML files. Just change ListView's orientation to Qt.Horizontal. By incrementing and decrementing the currentIndex the items in the ListView will slide accordingly. Also just make sure the delegates size is filled to the screen size to get a feel similar to what you are trying.

        M Offline
        M Offline
        Maxim DC
        wrote on 12 Jun 2015, 11:12 last edited by
        #3

        @p3c0 Thanks for this reply, but would it be possible to load .qml trough Stackview, because putting the whole code in 1 file is very chaotic

        P 1 Reply Last reply 12 Jun 2015, 11:38
        0
        • M Maxim DC
          12 Jun 2015, 11:12

          @p3c0 Thanks for this reply, but would it be possible to load .qml trough Stackview, because putting the whole code in 1 file is very chaotic

          P Offline
          P Offline
          p3c0
          Moderators
          wrote on 12 Jun 2015, 11:38 last edited by
          #4

          @Maxim-DC Yes it is possible. You can find an example here. The exact file in it where it is used.

          157

          1 Reply Last reply
          0

          2/4

          12 Jun 2015, 05:51

          • Login

          • Login or register to search.
          2 out of 4
          • First post
            2/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved