Passing list of Structure to QML
-
Hello Everyone,
I am newbie in Qt Quick. I am making a project in which i need to get list of contacts as list of strutcs. Then i need to pass this list to QML. But i don't know how to do this. So please give me suggestion about this.
Thanks in advance. -
It depends how deep you need to go into rabbit hole. At first it is unclear where from you need to pass list to QML. ListModel basically fits your needs: http://doc.qt.digia.com/qt/qml-listmodel.html
If you need to pass list from C++ to QML when look here (it should give at least several different ideas where to start): http://qt-project.org/wiki/How_to_use_a_QSqlQueryModel_in_QML
-
Thanks for Your reply.
I want to pass list from C++. I don't want to access sql directly. Actually i want to use model & view concept.
-
You should look links I gave more closely. Second one gives link to this blog article: http://cdumez.blogspot.com/2010/11/how-to-use-c-list-model-in-qml.html