How to send a property to another qml file?
I am new to QML, and start to work on the first few apps for symbian. :)
The simple app would consist of 2 qml pages:
The first qml page would include a tumbler element for the user to select a value. Then, I will use the selected value to generate a URL and open it in a webview in the second qml page.
My problem is after I generated the URL in a property string in the first qml, how can I get the string to send to the 2nd qml page?
Seems simple step, but I really cannot figure it out in the Wiki. Thanks for your help in advance!
Re: How to send a property to another qml file?
How are you handling the pages? If you are using the pageStack you can try passing the string in a property as described [URL="http://doc.qt.nokia.com/qt-components-symbian/qml-pagestack.html#passing-parameters-to-pages"]here[/URL].
Br,
Villep
Re: How to send a property to another qml file?
Thanks for the tips!
I try it with PageStackWindow, and try to pass the string using the code below:
[I]
pageStack.push(Qt.resolvedUrl("page2.qml"), {message: window.url="http://www.example.com"+firstTumbler})
[/I]
but I have got an error while running the app:
file:///C:/QtSDK/Simulator/Qt/mingw/imports/com/nokia/symbian.1.1/PageStack.js:153: Error: Cannot assign to non-existent property "message"
Any hints? Do I have to declare the property url in the pagestackwindow, page1, and page2?
Re: How to send a property to another qml file?
All you need to do is declare the property message in page2.qml. You can rename the parameter as you wish, just make sure the property you use in pageStack.push is some existing property.
For example in page2.qml
[CODE]
property string message: ""
[/CODE]
Br,
Villep
Re: How to send a property to another qml file?
It is working now, thanks Villep! :)