[SailfishDevel] Passing parameters back?

Andrey Kozhevnikov coderusinbox at gmail.com
Mon May 11 11:29:34 UTC 2015


using normal page you can connect to page status changing using 
javascript code:

onClicked: {
     var page = pageStack.push(Qt.resolvedUrl("BreweryDetailsPage.qml"), 
{ model:
locid });
     page.statusChanged.connect(function() { if (page.status == 
PageStatus.Inactive) /* do something with page.locid property */ })

using dialog page there are acceptDestination* properties set you can 
use for this behaviour.

11.05.2015 16:21, Chris Walker пишет:
> Hopefully somebody can help me with this problem.
> In my app, I'm using this approach to set up and use various models :-
> https://wiki.qt.io/How_to_Use_a_QSqlQueryModel_in_QML
> I have a list of breweries in the first page and when one is selected,
> I pass a parameter to the second page like this :-
>              onClicked:
> pageStack.push(Qt.resolvedUrl("BreweryDetailsPage.qml"), { model:
> locid });
> But I want my sql statement to only pick out the details for 'locid'
> and therefore I need to pass that back to the main cpp file which is
> set like this :-
>      view->rootContext()->setContextProperty("breweryInfomodel",
> breweryInfomodel);
> Note that I have yet to add the code to pass in the locid argument!
> Is such a thing possible (my main reason for doing it this way is that I
> would like to keep all the relevant code in the same place) or is the
> only way to filter the full list of 'locid's in the
> BreweryDetailsPage.qml ?
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org

More information about the Devel mailing list