[SailfishDevel] Pass data from MainPage into CoverPage

Andrea Bernabei and.bernabei at gmail.com
Mon Jun 3 09:17:47 UTC 2013


Hi Michael :)

Just delete the properties in the page and cover, and use appWindow.total
when you want to read/write on it, and you're set ;)

Let me know if that works!


2013/6/3 Michael Faro-Tusino <mfaro-tusino at live.com>

> Hi guys,
>
> This is a very beginner question I know, but still having some troubles.
>
> I am trying to create a Cover Page for my app, that uses information from
> the Main Page (note: this is not main.qml but MainPage.qml).
>
> I've attempted to set up property aliases like so:
>
> //main.qml
> import QtQuick 1.1
> import Sailfish.Silica 1.0
> import "pages"
> import "cover"
>
> ApplicationWindow
> {
>        id: appWindow
>     property string total
>     property string perPerson
>     initialPage: MainPage { }
>     cover: CoverPage{ }
> }
>
> //MainPage.qml
> import QtQuick 1.1
> import Sailfish.Silica 1.0
>
> Page{
>     id: mainPage
>     property alias total : appWindow.total
>     property alias perPerson : appWindow.perPerson
> }
>
> //coverPage.qml
> import QtQuick 1.1
> import Sailfish.Silica 1.0
>
>
>
> Page {
>     id: coverPage
>     property alias total: appWindow.total
>     property alias perPerson: appWindow.perPerson
> }
>
> I get errors saying that appWindow cannot be found, due to errors caused
> by using initialPage: MainPage{} and cover: CoverPage{} in my main.qml.
>
> I don't see why setting Initial and cover the way I did results in errors,
> (so that is something I'd like explained if possible) and secondly, could
> someone help me pass the information from MainPage to CoverPage (it updates
> when a function is executed on MainPage if that makes a difference).
>
> Thanks in advance,
> Michael
>
>
> -------------------------
> Michael Faro-Tusino
>
> Twitter: @MFaroTusino <http://twitter.com/MFaroTusino>
> Website: My Nokia Blog <http://mynokiablog.com>
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sailfishos.org/pipermail/devel/attachments/20130603/8d191a98/attachment.html>


More information about the Devel mailing list