[SOLVED] Transitions between screens
-
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?
-
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.
-
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.