How to clear an XML model after we have read it?
-
Hi everyone,
I have an xmlDataModel, and I change the query several times, to read different children in the XML tree.
Since I re-use the same model several times, I think it is important that I clear the xmlModel, before I populate it again.I have tried:
@function clearItems(objectsModel)
{
print("Count of Model: "+objectsModel.count);
while(objectsModel.count > 0)
{
objectsModel.remove(0);
}
}@Output is:
@qml: Count of Model: 2
qrc:///JsFunctions.js:148: TypeError: Property 'remove' of object QQuickXmlListModel(0x1040c97e0) is not a function@So how to clear the xmlModel after reading the items from it?
-
Hi,
I guess assigning a new source to XmlListModel should remove the old one.