[SailfishDevel] How to convert Xml list model into QML list model?

Jollailija Developer jollailija at gmail.com
Fri Dec 11 19:28:58 UTC 2015


Hi,

I am using Alpha Menu (People app style sorting) in my app. However it only
supports QML ListModel as it's dataSource. I tried doing this:

    StationsModel {id:stationsModel}


    ListModel {

        id: qmlListModel

    }

        Component.onCompleted: {console.log(lib.stationCount);fillList()}


    function fillList() {

        var i = 0

        for (var r = 0; r < lib.stationCount; r++) {

            qmlListModel.append({"title": stationsModel.get(i).title})
//< line 52

            i ++

            console.log(i)

        }

    }


 Well, it isn't working. What's wrong with it? Here's the output:

[W] unknown:52 -
file:///usr/share/harbour-nettiradio/qml/Pages/StationGridView.qml:52:
TypeError: Cannot read property 'title' of undefined


 "Good night to you, dear devs!" wishes
jollailija
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20151211/24ec71c3/attachment.html>


More information about the Devel mailing list