PDA

View Full Version : how implement different views



Sunny31
11th December 2010, 12:50
I've a main.qml file, the UI looks like this:



############################################
# FIRST_SCENE # SECOND_SCENE # THIRD_SCENE #
############################################


Each '*_SCENE' represents a button which redirects to a .qml file.
my question is, how can I implement such a thing in QtQuick?
I mean, how do I show a different .qml file with a nice effect while switching to the other .qml file?


thanks

Added after 1 9 minutes:

My post is a bit confusing...

I have 3 .qml file.
Each file represents a totally different scene with its own widgets. If the user clicks on the button 'SECOND_SCENE' the second .qml file should be shown smooth. how do I realize that?
I couldn't find anything in the examples.

laszlo.gosztola
11th December 2010, 15:28
I created an item like this


Item {
id: loadedItem
Loader {
source
}
}


and used this item as a flippable.front, an other one as flippable.back.
So i can change the qml in run-time.

Sunny31
11th December 2010, 15:39
not really what I wanted.
your solution works good if I just have 2 views. but I have over 3 views!
but thanks for your answer!

I have something like this:
http://www.codeproject.com/KB/android/AndroidTabs/Tabs3.jpg

I want to switch between these tabs, each tab represents an INDIVIDUAL QML FILE, with its OWN WIDGETS.

If the user clicks on TAB 1, a signal is triggered to the c++ application where I change the view. yeah I can call a 'view.setSource("tab1.qml")', but what happens with the Signal-Slot connections to the qml-Widgets?
my other idea was to have multiple QDeclarativeViews, but every time if a QDeclarativeView is showed a new window pops up.
I also want a nice effect while switching between these qml files (= tabs)

aamer4yu
29th December 2010, 16:17
There was some example in Qt demos.. or may be on Qt Labs / Dojo.
Search for parallex qml .