Hi Chris, I suppose you have all the breweries' data in a DB table referenced by breweryInfoModel and need to extract data by locid. In this case you could wrap your breweryInfoModel in a QSortFilterProxyModel [1] and just use its filtering methods. In this case you would basically need to set your breweryInfoModel as a source model for QSortFilterProxyModel, it does all the rest for you.
If you feel that QSortFilterProxyModel is not what you need, it could help then if you would go into details of your DB model. Cheers Dmitriy [1] http://doc.qt.io/qt-5/qsortfilterproxymodel.html 2015-05-11 17:21 GMT+06:00 Chris Walker < cdw_noki...@the-walker-household.co.uk>: > 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-unsubscr...@lists.sailfishos.org >
_______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org