What is the syntax to properly use a variable in a Qt Qml XmlLIstModel query
-
wrote on 25 Jul 2013, 17:47 last edited by
I have the following XmlListModel defined.
I have tested it and it returns all of the items in the xml file.
I would like to filter it using a variable passed in to it, such as Parentpageid = my_variable.
Can someone please show me how to do this. I want to filter this xml and return the items that match the value of my_variable.Thanks.
@import QtQuick 2.0
import QtQuick.XmlListModel 2.0XmlListModel {
id: ios_elementsModel
source: "/TestCode/PositionersAndRepeaters/PositionersAndRepeaters/menuitems.xml"
query: "/MenuItems/MenuItem"XmlRole { name: "id"; query: "id/number()" } XmlRole { name: "type"; query: "type/string()" } XmlRole { name: "index"; query: "index/string()" } XmlRole { name: "verbage"; query: "verbage/string()" } XmlRole { name: "parentpageid"; query: "Parentpageid/number()" } XmlRole { name: "destinationpageid"; query: "destinationpageid/number()" }
}@
1/1