<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">You could also create a shared (stateless) JS library which you can use to share variables between different qml documents.<br></div><div class="gmail_extra">
<br><br><div class="gmail_default" style="font-family:tahoma,sans-serif">​/Mikko​</div><br><br><div class="gmail_quote">2014-06-06 9:47 GMT+03:00 Andrey Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">i have an another idea for you:<br>
<br>
...<br>
var newPage = pageStack.push(Qt.resolvedUrl(<u></u>"newPage.qml"), {...})<br>
newPage.done.connect(thisPage.<u></u>pageDone)<br>
...<br>
<br>
//thisPage<br>
...<br>
function pageDone(var1, var2, var3, ...) {<br>
//do something with var<br>
}<br>
...<br>
<br>
//newPage<br>
...<br>
signal done(string var1, int var2, string var3, ...)<br>
...<br>
<br>
//Button<br>
...<br>
onClicked: {<br>
page.done("something", 123, "test", ...)<br>
}<br>
...<br>
<br>
05.06.2014 22:49, <a href="mailto:info@flyingfischer.ch" target="_blank">info@flyingfischer.ch</a> пишет:<div class="HOEnZb"><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Chris<br>
<br>
thanks for this idea and your code example!<br>
<br>
I am working on app in a very early stage that will partially talk to a remote server and get dynamic content. In some cases it even will create a little bit of traffic...<br>
<br>
...so I will stick for the moment with the solution provided by Konstantin.<br>
<br>
Regarding the use of Dialog:<br>
<br>
I come from the Java world and am an absolute newbie on QT. I couldn't figure out how this would work. The documentation from Sailfish OS || QT is not very clear about this, at least not for me.<br>
<br>
...but I intend to learn and will certainly restudy the docu and try to check out other use cases from other apps, untill I get it ;-)<br>
<br>
Thanks to anybody!<br>
<br>
Markus<br>
<br>
Am 05.06.2014 16:40, schrieb Christopher Lamb:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Markus<br>
<br>
In my app I chose to instantiate all my Pages in the same place. Each of<br>
the pages has a declaration in a separate qml file (e.g. MainPage.qml,<br>
AreaSelectionPage.qml).<br>
<br>
With this architecture none of the declarations need to know about the<br>
previous or next page. It is not their concern. Instead they emit<br>
signals NextPage, BackPageWithInfo, and Cancelled. In the signal handler<br>
in the page instantation I do the actual pushing and popping, and<br>
because all pages are instantiated in the same scope, they are all<br>
available to be pushed / popped to. (see code example below).<br>
<br>
The downside is that all the pages are created on startup (regardless of<br>
if they are ever visited). For lightweight pages this is not a problem,<br>
but for some pages this might be a problem. For these I dynamically<br>
create the page content when the page is visible.<br>
<br>
Grüsse<br>
<br>
Chris<br>
<br>
<br>
ApplicationWindow {<br>
<br>
id: appWindow<br>
<br>
.......<br>
<br>
initialPage: mainPage<br>
<br>
MainPage {<br>
<br>
id: mainPage<br>
<br>
....<br>
<br>
onNextPage: {<br>
<br>
if (pageType =="SMS") {<br>
<br>
console.log("smsType is: " + smsType)<br>
<br>
if (smsType =="Default") pageStack.push(smsPage, {lati: mainPage.getLati(), longi: mainPage.getLongi(), alti: mainPage.getAlt<br>
i(), area_id: area_id, template_id: template_id, msg_status: msg_status, lastPage: "mainPage"})<br>
<br>
}<br>
<br>
else {<br>
<br>
pageStack.push(<u></u>areaSelectionPage)<br>
<br>
}<br>
<br>
}<br>
<br>
}<br>
<br>
AreaSelectionPage {<br>
<br>
id: areaSelectionPage<br>
<br>
....<br>
<br>
onBackPageWithInfo: {<br>
<br>
mainPage.areaSet = true;<br>
<br>
mainPage.area_id = area_id;<br>
<br>
pageStack.pop(mainPage);<br>
<br>
}<br>
<br>
onCancelled: pageStack.pop(mainPage);<br>
<br>
}<br>
<br>
SMSPage {<br>
<br>
id: smsPage<br>
<br>
....<br>
<br>
onNextPage: {<br>
<br>
pageStack.push(<u></u>contactSelectionPage, {area_id: area_id, template_id: template_id})<br>
<br>
}<br>
<br>
}<br>
<br>
ContactSelectionPage {<br>
<br>
id: contactSelectionPage<br>
<br>
....<br>
<br>
onBackPageWithInfo: {<br>
<br>
console.log("About to pop smsPage; contactName: " + contactName + ", contactPhone: " + contactPhone);<br>
<br>
smsPage.contactName = contactName;<br>
<br>
smsPage.contactPhone = contactPhone;<br>
<br>
smsPage.lastPage = "contactSelectionPage";<br>
<br>
pageStack.pop(smsPage);<br>
<br>
}<br>
<br>
onCancelled: pageStack.pop(smsPage);<br>
<br>
}<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On 05.06.14 14:43, <a href="mailto:info@flyingfischer.ch" target="_blank">info@flyingfischer.ch</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks for your inputs!<br>
<br>
Calling<br>
<br>
PreviousPage.topic = "MyTopic";<br>
pageStack.pop();<br>
<br>
gives me a ReferenceError: PreviousPage is not defined.<br>
<br>
PreviousPage.qml and property string topic do exist.<br>
<br>
Thanks for your patience!<br>
<br>
Markus<br>
<br>
______________________________<u></u>_________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to<br>
<a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.<u></u>sailfishos.org</a><br>
</blockquote>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.<u></u>sailfishos.org</a><br>
<br>
</blockquote>
______________________________<u></u>_________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.<u></u>sailfishos.org</a><br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.<u></u>sailfishos.org</a></div></div></blockquote></div><br>

</div></div>