[SailfishDevel] Pass data from MainPage into CoverPage
Lucien XU
sfietkonstantin at free.fr
Mon Jun 3 08:09:22 UTC 2013
Hello Mike,
I don't think it is a good idea to alias someting that is in another
component. Usually, you alias a property of a child component to expose it
outside.
But you can access the properties defined in appWindow from the cover page.
Isn't that enough ?
Cheers,
Lucien
Le lundi 3 juin 2013 12:58:27 Michael Faro-Tusino a écrit :
> 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
> Website: My Nokia Blog
More information about the Devel
mailing list