XmlListModel no Get()
Solved
QML and Qt Quick
-
Hi everyone.
So I've successfully created a model using the XmlListModel everything is working as intended. Before I was using a regular ListModel and writing all my data directly in QML. With the list model I could do something like :
listModel.get(i).name
How would I do this with an XmlListModel? Here's the model I am using as an example.
XmlListModel {
id: xmlModel source: "file:data/carousel_objects.xml" query: "/objects/item" XmlListModelRole {name: "title"; elementName: "title"} XmlListModelRole {name: "year"; elementName: "year"} XmlListModelRole {name: "sourceForeground"; elementName: "sourceForeground"} XmlListModelRole {name: "sourceBackground"; elementName: "sourceBackground"} }
Thank you all in advance.
Edit: I'm using Qt 6.6
-
@danilo_jn This previous discussion might help. It suggests a workaround.
https://forum.qt.io/topic/135419/get-method-removed-from-xmllistmodel
-