<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Markus<br>
<br>
In my app I chose to instantiate all my Pages in the same place.
Each of the pages has a declaration in a separate qml file (e.g.
MainPage.qml, AreaSelectionPage.qml).<br>
<br>
With this architecture none of the declarations need to know about
the previous or next page. It is not their concern. Instead they
emit signals NextPage, BackPageWithInfo, and Cancelled. In the
signal handler in the page instantation I do the actual pushing and
popping, and because all pages are instantiated in the same scope,
they are all 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 if they are ever visited). For lightweight pages this
is not a problem, but for some pages this might be a problem. For
these I dynamically create the page content when the page is
visible.<br>
<br>
Grüsse<br>
<br>
Chris<br>
<br>
<br>
<meta name="qrichtext" content="1">
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->ApplicationWindow<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">id</span>:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">appWindow</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> .......</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">initialPage</span>:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">mainPage</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">MainPage</span><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">id</span>:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">mainPage</span></pre>
....<br>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">onNextPage</span>:<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" font-style:italic; color:#2985c7;">pageType</span><span style=" color:#c0c0c0;"> </span>==<span style=" color:#008000;">"SMS"</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#0055af;">console</span>.log(<span style=" color:#008000;">"smsType</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">is:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">smsType</span>)</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" font-style:italic; color:#2985c7;">smsType</span><span style=" color:#c0c0c0;"> </span>==<span style=" color:#008000;">"Default"</span>)<span style=" color:#c0c0c0;"> </span>pageStack.push(<span style=" font-style:italic; color:#000000;">smsPage</span>,<span style=" color:#c0c0c0;"> </span>{lati:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">mainPage</span>.getLati(),<span style=" color:#c0c0c0;"> </span>longi:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">mainPage</span>.getLongi(),<span style=" color:#c0c0c0;"> </span>alti:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">mainPage</span>.getAlt
i(),<span
style=" color:#c0c0c0;"> </span>area_id:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">area_id</span>,<span style=" color:#c0c0c0;"> </span>template_id:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">template_id</span>,<span style=" color:#c0c0c0;"> </span>msg_status:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">msg_status</span>,<span style=" color:#c0c0c0;"> </span>lastPage:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"mainPage"</span>})</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">else</span><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>pageStack.push(<span style=" font-style:italic; color:#000000;">areaSelectionPage</span>)</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">AreaSelectionPage</span><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">id</span>:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">areaSelectionPage</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">....</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">onBackPageWithInfo</span>:<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">mainPage</span>.areaSet<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>true;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">mainPage</span>.area_id<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">area_id</span>;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>pageStack.pop(<span style=" font-style:italic; color:#000000;">mainPage</span>);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">onCancelled</span>:<span style=" color:#c0c0c0;"> </span>pageStack.pop(<span style=" font-style:italic; color:#000000;">mainPage</span>);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">SMSPage</span><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">id</span>:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">smsPage</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">....</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">onNextPage</span>:<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>pageStack.push(<span style=" font-style:italic; color:#000000;">contactSelectionPage</span>,<span style=" color:#c0c0c0;"> </span>{area_id:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">area_id</span>,<span style=" color:#c0c0c0;"> </span>template_id:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">template_id</span>})</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ContactSelectionPage</span><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">id</span>:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">contactSelectionPage</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">....</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">onBackPageWithInfo</span>:<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#0055af;">console</span>.log(<span style=" color:#008000;">"About</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">pop</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">smsPage;</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">contactName:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">contactName</span><span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">",</span><span style=" color:#c0c0c0;"> </span><span
style=" c
olor:#008000;">contactPhone:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">contactPhone</span>);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">smsPage</span>.contactName<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">contactName</span>;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">smsPage</span>.contactPhone<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">contactPhone</span>;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">smsPage</span>.lastPage<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"contactSelectionPage"</span>;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>pageStack.pop(<span style=" font-style:italic; color:#000000;">smsPage</span>);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">onCancelled</span>:<span style=" color:#c0c0c0;"> </span>pageStack.pop(<span style=" font-style:italic; color:#000000;">smsPage</span>);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">}<!--EndFragment--></pre>
<style type="text/css">
p, li { white-space: pre-wrap; }
</style><br>
<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 05.06.14 14:43,
<a class="moz-txt-link-abbreviated" href="mailto:info@flyingfischer.ch">info@flyingfischer.ch</a> wrote:<br>
</div>
<blockquote cite="mid:539065EE.2020102@flyingfischer.ch" type="cite">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>
_______________________________________________
<br>
SailfishOS.org Devel mailing list
<br>
To unsubscribe, please send a mail to
<a class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a>
<br>
</blockquote>
<br>
</body>
</html>