Generate an XML file using the QML Listmodel
Ravikiran V N
I would like to generate a xml file (either in SAX or DOM format whichever is convenient) using a Qt C++ class and the data for the creation of this xml file need to fetched from the QtQuick List model(data model).
When the data has been extracted from the data model it will need to be written to a file.
Please suggest possible solutions for the same.
The are several ways access a
ListModelfrom C++. In each case you will need to get access to
ListModelobject which can be done by using
findChildprovided you have set
ListModel. Once that is done,
QAbstractItemModelso once you get access of
ListModelon C++ side, cast it to
QAbstractItemModeland use it functions for eg. data() to access the
Hope this gets you going :)
Btw. can you explain why you are preferring populating
ListModelinstead of C++ models directly ? As anyway at the end you are coming to C++ for further processing.