Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-23 Thread Kimmo Lindholm
parameterListModel.append({"parameter": par, "value": tmp[par]}) } } -kimmo From: devel-boun...@lists.sailfishos.org [mailto:devel-boun...@lists.sailfishos.org] On Behalf Of Jarko Vihriala Sent: Friday, May 23, 2014 11:24 AM To: Sailfish OS Developers Subject: Re: [Sa

Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-23 Thread Andrey Kozhevnikov
you can check Mitakuuluu QueryExecutor asynchronous SQLite implementation: https://github.com/CODeRUS/mitakuuluu2/tree/master/threadworker And my contacts and converstaion models fetching data from SQLite: https://github.com/CODeRUS/mitakuuluu2/tree/master/client/src 23.05.2014 12:17, Kimmo Li

Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-23 Thread Jarko Vihriala
rom: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] on behalf of Mikko Leppänen [mleppa...@gmail.com] Sent: Friday, May 23, 2014 11:20 AM To: Sailfish OS Developers Subject: Re: [SailfishDevel] Technical question: populating ListModel from C++ Hi, Or if you don't want

Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-23 Thread Mikko Leppänen
Hi, Or if you don't want to subclass e.g. qabstractitemmodel, you can always return a QVariantList(or QList) from c++ and expose that sequence to QML. Then use that JS array to populate ListModel. /Mikko 2014-05-23 10:53 GMT+03:00 Markus Svensson : > Hi, > > I have done the same thing in my Sa

Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-23 Thread Markus Svensson
Hi, I have done the same thing in my Sailfish learning project. It was way more complicated than I would have liked it to be (or maybe I did it in the wrong way...). Feel free to have a look at how I implemented it: https://github.com/Ortofta/SilicaNote The code quality is probably not the be

Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-22 Thread Kimmo Lindholm
Hi,, Thank you Janne and Jarko, I will take a look on both of these approaches; > use the QSqlQueryModel in your c++ and expose that to QML ; just like in : > http://qt-project.org/wiki/How_to_use_a_QSqlQueryModel_in_QML > subclassing QAbstractItemModel. See > http://qt-project.org/doc/qt-5/q

Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-22 Thread Jarko Vihriala
Kimmo Lindholm [kimmo.lindh...@eke.fi] Sent: Friday, May 23, 2014 9:17 AM To: devel@lists.sailfishos.org Subject: [SailfishDevel] Technical question: populating ListModel from C++ Hi All, What would be the best method to populate ListModel in QML from the C++ side? I have sqlite database, which

Re: [SailfishDevel] Technical question: populating ListModel from C++

2014-05-22 Thread Janne Kokko
Hi, I suggest you implement the model yourself by subclassing QAbstractItemModel. See http://qt-project.org/doc/qt-5/qtquick-modelviewsdata-cppmodels.html and http://qt-project.org/doc/qt-5/qabstractitemmodel.html to get started. -- Janne 2014-05-23 9:17 GMT+03:00 Kimmo Lindholm : > Hi All, > >

[SailfishDevel] Technical question: populating ListModel from C++

2014-05-22 Thread Kimmo Lindholm
Hi All, What would be the best method to populate ListModel in QML from the C++ side? I have sqlite database, which contents I would like to put on ListView. List is changed only by user when deleting or adding entry, upon this action I would like to update sqlite and then refresh listmodel. -