Sending commands to another QML when mousarea is clicked
-
Others looks ok .. but for status you cannot use mainLoader.source. Have an instance of status created and keep it always and call a method of it when ever you want to update your status.
-
Hi,
please take a look to the Qt-Complex framework I have released. It works with a loader object (a replica of the Qml loader with some custom properties) and see how it works. You can include the framework in your code and use it, it is done just for this.
The principle is that you canuse the how many different instances of the same loader structure and destroy the loaded objects when you need. The events are passed between the loaded objects and the main objects throught the loader in a transparent mode while all the properties changes / settings are done binding values to custom properties between the main qml and the loader instances while are managed with functions between the loaded object and the loader properties.
Thus, you pass parameters in a independent way while events works like a pass-thorugh.
I put a first quick-start guide of the framework on the wiki and the last updated documentation can be found together with the sources at projects.developer.nokia.com/Qt-ComplexIf see before the Qt-Complex project you find also a test application qml document where there is an example of loaded objects and previously loaded objects deleted by another object.
-
@Alicemirror, Did you prepare a wiki with available elements documentation, and the steps to include Qt-Complex framework in to applications? And few samples will also help.
I guess if you have good documentation, it will become easy for people to try it out.
-
@Vijay, I am doing so. This is the Beta 1.0 today I release the 1.0 rc. This complete version includes the dynamic gemonmetry management for multiple devices. The documentation is on for some pieces and other will be updated in very few time. I have already started to write a first wiki page "here":http://developer.qt.nokia.com/wiki/category:Tools::QtComplex. This page incldes the link to the full documentation on the project wiki. All will be updated shortly.
-
[quote author="Vijay Bhaska Reddy" date="1310999670"]It looks like a perfect duplicate of "Creating a status QML for my virtual pet game":http://developer.qt.nokia.com/forums/viewthread/7866/
[/quote]I deleted the duplicated thread.
-
what if i join all the items in my status qml to my home qml,
-
did not get you .. do you mean creating an alias property in your home.qml for all the status properties in yoru status.qml??
Can you elaborate...
-
i will remove the status qml, and i will create texts in my home qml that will show the status of my pet which is hunger and had a default value of 50.
just like what i said on my first post, if click the feed mousearea it will show my feed qml that shows the dog eating his food. when i go back to my home qml, the hunger status of my pet will increase to 5, how can i do that. -
@Vijay Bhaska Reddy youre righ, when i load another qml using loader, the items on my qml are reset to its original value, how can i fix that?
Is there any other way i can view other qml using mousearea without resetting my qml?
-
If you use Loader, it will always reset. Try other approaches and post code if you face any problem.
But one thing for sure you need to store status / store in global object.
Try out storing it in C++ side, expose few properties of a QObject derived class and updated them with your score/status in your QML side.
When you call status.qml page, read these properties and display them. This seems like a reasonable solution to me.
-
Also, another thought, depending on the structure of your app's QML and how many elements you have, and so on, you could possibly forego the Loader altogether and create all of your elements at runtime. Then you could set the opacity or visible properties to show or hide individual elements as needed. That way you could still maintain bindings between different elements of your application.
-
After clicking mousearea to load another qml, i will make the changed items properties i dont want to reset? OK ill try this, Thanks, hope this will work