<div dir="ltr"><div><div><div><div>Hi Chris,<br><br></div>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.<br><br></div>If you feel that QSortFilterProxyModel is not what you need, it could help then if you would go into details of your DB model.<br><br></div>Cheers<br></div>Dmitriy<br><div><div><div><br>[1] <a href="http://doc.qt.io/qt-5/qsortfilterproxymodel.html">http://doc.qt.io/qt-5/qsortfilterproxymodel.html</a><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-05-11 17:21 GMT+06:00 Chris Walker <span dir="ltr"><<a href="mailto:cdw_nokiaqt@the-walker-household.co.uk" target="_blank">cdw_nokiaqt@the-walker-household.co.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hopefully somebody can help me with this problem.<br>
<br>
In my app, I'm using this approach to set up and use various models :-<br>
<a href="https://wiki.qt.io/How_to_Use_a_QSqlQueryModel_in_QML" target="_blank">https://wiki.qt.io/How_to_Use_a_QSqlQueryModel_in_QML</a><br>
<br>
I have a list of breweries in the first page and when one is selected,<br>
I pass a parameter to the second page like this :-<br>
            onClicked:<br>
pageStack.push(Qt.resolvedUrl("BreweryDetailsPage.qml"), { model:<br>
locid });<br>
<br>
But I want my sql statement to only pick out the details for 'locid'<br>
and therefore I need to pass that back to the main cpp file which is<br>
set like this :-<br>
    view->rootContext()->setContextProperty("breweryInfomodel",<br>
breweryInfomodel);<br>
<br>
Note that I have yet to add the code to pass in the locid argument!<br>
<br>
Is such a thing possible (my main reason for doing it this way is that I<br>
would like to keep all the relevant code in the same place) or is the<br>
only way to filter the full list of 'locid's in the<br>
BreweryDetailsPage.qml ?<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br>
</blockquote></div><br></div>