Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED] Transitions between screens

    QML and Qt Quick
    4
    6
    8215
    Loading More Posts
    • 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.
    • B
      borut123 last edited by

      I'm developing Qt app which uses Qt/C++ (for fetching data from server, handling all the logic), and QML for GUI.

      How should I handle transitions between different qml screens?

      Currently I do it like this:
      QDeclarativeView *view = new QDeclarativeView;
      view->setSource(QUrl::fromLocalFile("screen1.qml"));
      view->show();

      And when another qml needs to be shown on the screen, I do it again:

      QDeclarativeView *view = new QDeclarativeView;
      view->setSource(QUrl::fromLocalFile("screen2.qml"));
      view->show();

      Is there any better way to handle transitions between screens?

      1 Reply Last reply Reply Quote 0
      • A
        alexander last edited by

        Maybe it will be better if you create one main qml screen which switches subscreens.

        1 Reply Last reply Reply Quote 0
        • B
          borut123 last edited by

          Could you please be more specific?

          1 Reply Last reply Reply Quote 0
          • D
            DenisKormalev last edited by

            What I've done at similar problem (but I need something that will work really flexible when user can change first qml, second qml and qml with transition).

            I created 3 QDeclarativeView's (for first screen, for second screen, for qml with transition beetwen screens)

            I added views with screens to transition view as children (through proxywidget)

            Started transition at transition view

            After transition completes I removed views with first screen and transition and left only view with second screen.

            If you can hardcode transition in your app you can use Animations Framework for it directly in c++ code.

            1 Reply Last reply Reply Quote 0
            • 2
              2beers last edited by

              Not sure if this helps but like alexander said you can use one screen with main.qml and you can switch screens from qml and not from C++. there are many ways to do this. one of them is to use "Loader":http://doc.qt.nokia.com/4.7/qml-loader.html

              Now depends of your program and what are you trying to do. if you want an animated transition between screens you can use "Transitions":http://doc.qt.nokia.com/4.7/qml-transition.html. at least this is how I did.

              1 Reply Last reply Reply Quote 0
              • B
                borut123 last edited by

                thanks to all. I got the picture.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post