General questions about: Layout + State Machine Framework + Activitys using Qt Quick on Android
-
Hello friends,
I have a few questions to you regarding Qt on Android devices.
Especially the layout and activitys.
Also I have a problem to understand the State machine framework properly.((I am using QT5.2 Quick 2 for my Applications. qml file for the layout, c++ file for some logic))
Questions:
-
How should I implement the Intends for the activity changes in Qt?
Do I have to use the State Machine Framework for this? Are there other solutions? (No JNI solutions please) Do I simply have to use the Loader for a Layout change? -
For example: I have a userMenu.qml with Button "Accelerometer-Test". If this button is clicked, the accelerometer.qml layout with the Accelerometer component will be displayed. In this case, I should send a signal to my accelerometerLogic.cpp to connect to a sensor. If the user press now the home-button. What will my app do? Will it disconnect my "sensor listener" automaticially? And what would happen if I simply want to navigate back to my mainMenu. Do I have to disconnect the "signal listener" manually?
-
This is about the State Machine Framework:
I just had a look on the documentation about this framework. I don't understand currently how to use it properly. For example if I have a menu.qml with a menu. (Item1, Item2, ...) If I click on Item1, I want to show a calculator. Currently I would use States for this. Do I have to set all the other Items to visible=false, modifying their properties or is there a other (better, more efficient) solution for that?
Same thing as the answer below: I found the documentation for the Loader class. This solved my problem with "how to change layouts". I also have read some more documentation about the state machine framework. I think for "if I click on Calculator, I want to show a Calculator" I will not need states. I can solve this with the loader and Layouts. But maybe my solution is not the best(?) -
-Is it possible to change the layout for / in different states?
State "CalculatorApplication" has calculator.qml ... State "MailApplication" has mail.qml ...-
I just found the documentation for the Loader class. I think this is the answer for that question.
Thank you in advance for your comments!
Edit: Updated my questions
-