Re: [SailfishDevel] How to convert Xml list model into QML list model?
Okay, thanks, that's that issue gone. I did some trickery and now it runs 73 times and everything's groovy. I'll report any following issues, but now it's time to write some logic code that calls the function. 2015-12-12 8:56 GMT+02:00 Alexander Ladygin : > AFAIK you can not call any variables inside components from outside of > components > use > > QmlListModel{id:qmlListModel} > > indstead of > Component{QmlListModel{id:qmlListModel}} > > > On Sat, Dec 12, 2015 at 9:50 AM, Jollailija Developer < > jollail...@gmail.com> wrote: > >> Okay, I think I found the cause. The function needs to be somewhere where >> it can see both of the list models. The question is "where is that?" >> I wrote this into the main QML: >> >> Component{QmlListModel{id:qmlListModel}} >> >> Component{StationsModel{id:stationsModel}} >> >> >> function fillList() { >> >> var i = 0 >> >> for (var r = 0; r < 10; r++) { >> >> qmlListModel.append({"title": stationsModel.get(i).title}) // <- >> line 92 >> >> i ++ >> >> console.log(i) >> >> } >> >> } >> >> Timer { >> >> interval: 5000 >> >> repeat: false >> >> onTriggered: {fillList(); console.log("fill")} >> >> running: true >> >> } >> >> Quess what the console says? >> >> >> [W] unknown:92 - >> file:///usr/share/harbour-nettiradio/qml/harbour-nettiradio.qml:92: >> ReferenceError: qmlListModel is not defined >> >> >> Not defined? It's right there! >> >> I have no idea what I'm doing. >> >> (want to take a look? source at https://github.com/jollailija/nettiradio ) >> >> >> Cheers, >> >> Reference error: jollailija is not defined >> >> >> 2015-12-12 8:02 GMT+02:00 Jollailija Developer : >> >>> I switched onCompleted to this: >>> Component.onCompleted: qmlListModel.append({"title": stationsModel >>> .get(3).title}) >>> There should be over 70 items on this list. I think I will need to try >>> to do the conversion at some other place, maybe it can't see it. >>> >>> 2015-12-11 21:50 GMT+02:00 Alexander Ladygin : >>> seems like index out of bounds stationsModel items count is smaller than lib.stationCount On Fri, Dec 11, 2015 at 10:28 PM, Jollailija Developer < jollail...@gmail.com> wrote: > 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 > > > ___ > 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 >>> >>> >> >> ___ >> 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 > ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] How to convert Xml list model into QML list model?
AFAIK you can not call any variables inside components from outside of components use QmlListModel{id:qmlListModel} indstead of Component{QmlListModel{id:qmlListModel}} On Sat, Dec 12, 2015 at 9:50 AM, Jollailija Developer wrote: > Okay, I think I found the cause. The function needs to be somewhere where > it can see both of the list models. The question is "where is that?" > I wrote this into the main QML: > > Component{QmlListModel{id:qmlListModel}} > > Component{StationsModel{id:stationsModel}} > > > function fillList() { > > var i = 0 > > for (var r = 0; r < 10; r++) { > > qmlListModel.append({"title": stationsModel.get(i).title}) // <- > line 92 > > i ++ > > console.log(i) > > } > > } > > Timer { > > interval: 5000 > > repeat: false > > onTriggered: {fillList(); console.log("fill")} > > running: true > > } > > Quess what the console says? > > > [W] unknown:92 - > file:///usr/share/harbour-nettiradio/qml/harbour-nettiradio.qml:92: > ReferenceError: qmlListModel is not defined > > > Not defined? It's right there! > > I have no idea what I'm doing. > > (want to take a look? source at https://github.com/jollailija/nettiradio ) > > > Cheers, > > Reference error: jollailija is not defined > > > 2015-12-12 8:02 GMT+02:00 Jollailija Developer : > >> I switched onCompleted to this: >> Component.onCompleted: qmlListModel.append({"title": stationsModel >> .get(3).title}) >> There should be over 70 items on this list. I think I will need to try to >> do the conversion at some other place, maybe it can't see it. >> >> 2015-12-11 21:50 GMT+02:00 Alexander Ladygin : >> >>> seems like index out of bounds >>> >>> stationsModel items count is smaller than lib.stationCount >>> >>> >>> >>> On Fri, Dec 11, 2015 at 10:28 PM, Jollailija Developer < >>> jollail...@gmail.com> wrote: >>> 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 ___ 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 >>> >> >> > > ___ > 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
Re: [SailfishDevel] How to convert Xml list model into QML list model?
Okay, I think I found the cause. The function needs to be somewhere where it can see both of the list models. The question is "where is that?" I wrote this into the main QML: Component{QmlListModel{id:qmlListModel}} Component{StationsModel{id:stationsModel}} function fillList() { var i = 0 for (var r = 0; r < 10; r++) { qmlListModel.append({"title": stationsModel.get(i).title}) // <- line 92 i ++ console.log(i) } } Timer { interval: 5000 repeat: false onTriggered: {fillList(); console.log("fill")} running: true } Quess what the console says? [W] unknown:92 - file:///usr/share/harbour-nettiradio/qml/harbour-nettiradio.qml:92: ReferenceError: qmlListModel is not defined Not defined? It's right there! I have no idea what I'm doing. (want to take a look? source at https://github.com/jollailija/nettiradio ) Cheers, Reference error: jollailija is not defined 2015-12-12 8:02 GMT+02:00 Jollailija Developer : > I switched onCompleted to this: > Component.onCompleted: qmlListModel.append({"title": stationsModel > .get(3).title}) > There should be over 70 items on this list. I think I will need to try to > do the conversion at some other place, maybe it can't see it. > > 2015-12-11 21:50 GMT+02:00 Alexander Ladygin : > >> seems like index out of bounds >> >> stationsModel items count is smaller than lib.stationCount >> >> >> >> On Fri, Dec 11, 2015 at 10:28 PM, Jollailija Developer < >> jollail...@gmail.com> wrote: >> >>> 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 >>> >>> >>> ___ >>> 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 >> > > ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] How to convert Xml list model into QML list model?
I switched onCompleted to this: Component.onCompleted: qmlListModel.append({"title": stationsModel .get(3).title}) There should be over 70 items on this list. I think I will need to try to do the conversion at some other place, maybe it can't see it. 2015-12-11 21:50 GMT+02:00 Alexander Ladygin : > seems like index out of bounds > > stationsModel items count is smaller than lib.stationCount > > > > On Fri, Dec 11, 2015 at 10:28 PM, Jollailija Developer < > jollail...@gmail.com> wrote: > >> 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 >> >> >> ___ >> 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 > ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] How to convert Xml list model into QML list model?
seems like index out of bounds stationsModel items count is smaller than lib.stationCount On Fri, Dec 11, 2015 at 10:28 PM, Jollailija Developer wrote: > 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 > > > ___ > 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
[SailfishDevel] How to convert Xml list model into QML list model?
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 ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] XmlListModel can't fetch data from a local .xml file
Alexander Ladygin kirjoitti pe joulukuuta 11 20:22:40 2015 GMT+0200: > mb you should delete first line in file > That solved the issue. Case closed. Thanks! Cheers, jollailija -- Lähetetty Jollastani ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] XmlListModel can't fetch data from a local .xml file
http://docs.basex.org/wiki/XQuery_Errors FODC0002 The specified document resource cannot be retrieved. -- Исходное сообщение -- От: jollail...@gmail.com Кому: devel@lists.sailfishos.org Отправлено: 11.12.2015 23:13:35 Тема: Re: [SailfishDevel] XmlListModel can't fetch data from a local .xml file Doesn't work, onCompleted says "file:///usr/share/harbour-nettiradio/qml/Pages/StationLists/xml/asemat.xml". On another note, the thing under it in the console says "Error FODC0002 in tag:trolltech.com,2007;QmlXmlPatterns:QIODeviceVariable:src, at line 1, column 38: Encountered incorrectly encoded content." Does that mean something is wrong with the xml file? Kimmo Lindholm kirjoitti pe joulukuuta 11 19:59:18 2015 GMT+0200: Try one more: source: Qt.resolvedUrl("xml/asemat.xml") And to debug, add this: Component.onCompleted: { console.log(source.toString()) } -kimmo -Original Message- From: devel-boun...@lists.sailfishos.org [mailto:devel-boun...@lists.sailfishos.org] On Behalf Of jollail...@gmail.com Sent: 11. joulukuuta 2015 19:26 To: devel@lists.sailfishos.org Subject: [SailfishDevel] XmlListModel can't fetch data from a local .xml file Hi! Since Nettiradio is ... a net radio, I figured I could use a xml file hosted on GitHub as a update-able station database. It works like a charm, but in case GitHub goes down or something, I'd like to have a local copy shipped with every release. However, XmlListModel doesn't seem to like reading local files. I have tried all kinds of local path urls but I can't get it working. What am I doing wrong? If you need to take a look at the code, you can find it at https://github.com/jollailija/nettiradio The xml file I'm trying to read is asemat.xml adn the list model file is StationsModel.qml Cheers, jollailija -- Lähetetty Jollastani ___ 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.or -- Lähetetty Jollastani ___ 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
Re: [SailfishDevel] XmlListModel can't fetch data from a local .xml file
Hey, what if the problem is that UTF-8 doesn't support åäö? I'll try another coding. Funny that it works while the file isn't local source. -- Lähetetty Jollastani ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] XmlListModel can't fetch data from a local .xml file
mb you should delete first line in file On Fri, Dec 11, 2015 at 9:13 PM, wrote: > Doesn't work, onCompleted says > "file:///usr/share/harbour-nettiradio/qml/Pages/StationLists/xml/asemat.xml". > > On another note, the thing under it in the console says "Error FODC0002 in > tag:trolltech.com,2007;QmlXmlPatterns:QIODeviceVariable:src, at line 1, > column 38: Encountered incorrectly encoded content." > Does that mean something is wrong with the xml file? > > Kimmo Lindholm kirjoitti pe joulukuuta 11 19:59:18 2015 GMT+0200: > > Try one more: > > > > source: Qt.resolvedUrl("xml/asemat.xml") > > > > And to debug, add this: > > > > Component.onCompleted: { > > console.log(source.toString()) > > } > > > > -kimmo > > > > -Original Message- > > From: devel-boun...@lists.sailfishos.org [mailto: > devel-boun...@lists.sailfishos.org] On Behalf Of jollail...@gmail.com > > Sent: 11. joulukuuta 2015 19:26 > > To: devel@lists.sailfishos.org > > Subject: [SailfishDevel] XmlListModel can't fetch data from a local .xml > file > > > > Hi! Since Nettiradio is ... a net radio, I figured I could use a xml > file hosted on GitHub as a update-able station database. It works like a > charm, but in case GitHub goes down or something, I'd like to have a local > copy shipped with every release. However, XmlListModel doesn't seem to like > reading local files. I have tried all kinds of local path urls but I can't > get it working. What am I doing wrong? > > > > If you need to take a look at the code, you can find it at > https://github.com/jollailija/nettiradio > > The xml file I'm trying to read is asemat.xml adn the list model file is > StationsModel.qml > > > > Cheers, > > jollailija > > -- > > Lähetetty Jollastani > > ___ > > 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.or > > -- > Lähetetty Jollastani > ___ > 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
Re: [SailfishDevel] XmlListModel can't fetch data from a local .xml file
Doesn't work, onCompleted says "file:///usr/share/harbour-nettiradio/qml/Pages/StationLists/xml/asemat.xml". On another note, the thing under it in the console says "Error FODC0002 in tag:trolltech.com,2007;QmlXmlPatterns:QIODeviceVariable:src, at line 1, column 38: Encountered incorrectly encoded content." Does that mean something is wrong with the xml file? Kimmo Lindholm kirjoitti pe joulukuuta 11 19:59:18 2015 GMT+0200: > Try one more: > > source: Qt.resolvedUrl("xml/asemat.xml") > > And to debug, add this: > > Component.onCompleted: { > console.log(source.toString()) > } > > -kimmo > > -Original Message- > From: devel-boun...@lists.sailfishos.org > [mailto:devel-boun...@lists.sailfishos.org] On Behalf Of jollail...@gmail.com > Sent: 11. joulukuuta 2015 19:26 > To: devel@lists.sailfishos.org > Subject: [SailfishDevel] XmlListModel can't fetch data from a local .xml file > > Hi! Since Nettiradio is ... a net radio, I figured I could use a xml file > hosted on GitHub as a update-able station database. It works like a charm, > but in case GitHub goes down or something, I'd like to have a local copy > shipped with every release. However, XmlListModel doesn't seem to like > reading local files. I have tried all kinds of local path urls but I can't > get it working. What am I doing wrong? > > If you need to take a look at the code, you can find it at > https://github.com/jollailija/nettiradio > The xml file I'm trying to read is asemat.xml adn the list model file is > StationsModel.qml > > Cheers, > jollailija > -- > Lähetetty Jollastani > ___ > 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.or -- Lähetetty Jollastani ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] XmlListModel can't fetch data from a local .xml file
Try one more: source: Qt.resolvedUrl("xml/asemat.xml") And to debug, add this: Component.onCompleted: { console.log(source.toString()) } -kimmo -Original Message- From: devel-boun...@lists.sailfishos.org [mailto:devel-boun...@lists.sailfishos.org] On Behalf Of jollail...@gmail.com Sent: 11. joulukuuta 2015 19:26 To: devel@lists.sailfishos.org Subject: [SailfishDevel] XmlListModel can't fetch data from a local .xml file Hi! Since Nettiradio is ... a net radio, I figured I could use a xml file hosted on GitHub as a update-able station database. It works like a charm, but in case GitHub goes down or something, I'd like to have a local copy shipped with every release. However, XmlListModel doesn't seem to like reading local files. I have tried all kinds of local path urls but I can't get it working. What am I doing wrong? If you need to take a look at the code, you can find it at https://github.com/jollailija/nettiradio The xml file I'm trying to read is asemat.xml adn the list model file is StationsModel.qml Cheers, jollailija -- Lähetetty Jollastani ___ 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
[SailfishDevel] XmlListModel can't fetch data from a local .xml file
Hi! Since Nettiradio is ... a net radio, I figured I could use a xml file hosted on GitHub as a update-able station database. It works like a charm, but in case GitHub goes down or something, I'd like to have a local copy shipped with every release. However, XmlListModel doesn't seem to like reading local files. I have tried all kinds of local path urls but I can't get it working. What am I doing wrong? If you need to take a look at the code, you can find it at https://github.com/jollailija/nettiradio The xml file I'm trying to read is asemat.xml adn the list model file is StationsModel.qml Cheers, jollailija -- Lähetetty Jollastani ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org