PDA

View Full Version : Looking for Example of QML using a table view editor via a C++ back end to edit XML



QutWizard
31st October 2014, 23:17
Right now I like the way the tableview example works, but I want to be able to edit and save the XML file, and it seems this example is read only using XmlListModel, and using the delegate to edit it, I need the data source to be editable, and not read only, I know I need to do this in the C++ back end, which I know how to create, and is very nice and powerful, but not sure what data type I should use to store the data in to allow saving it as an xml file when complete, this is where an example would be great, but I have been searching the internet for over a week, and I can not find one anywhere, it seems odd that they do not have an Example for such a useful feature as this, but I am sure there is a data type or Data Model, maybe its as simple as a class derived from QObject set to the source of a ListModel, but in the end, I have to save it as XML, which I am guessing I need to use QXmlStreamWriter, and maybe iterate through the data and fill in the right properties, so I am sure I will be able to figure it out the hard way, the old fashion way, write it and find out, but my guess is that there is an easier way to do it.

BTW: This app is called Qut Wizard, its part of the WittyWizard.org (http://wittywizard.org) Open Source Project that uses Wt for the Web Application and a Qt version of the Wizard called Qut Wizard, the idea is using a Qt Quick QML app to edit the web site, which is stored in XML documents, which can be uploaded later using ssh or ftp, which is more secure then a web based back end.

Thanks
Jeff Flesher

anda_skoa
1st November 2014, 12:42
The data structure of your model depends on your data and your needs.

You probably have rows of records, so your data structure could be a QList or QVector of record objects.

The model could then be a simple QAbstractListModel derived class, where the row indexes into the list and the role indexes into the record.

Cheers,
_