我在 qml 中使用 XmlListModel:
xml:
<? xml version="1.0" ?>
<queuelist>
<queue id="1" name="name" image="image.svg" turn="34" wait="50" />
</queuelist>
XmlListModel
XmlListModel {
id: queueModel
source: "queuelist.xml"
query: "/queuelist/queue"
XmlRole {name: id; query: "@id/string()"}
XmlRole {name: queue; query: "@name/string()"}
XmlRole {name: image; query: "@image/string()"}
XmlRole {name: turn; query: "@turn/string()"}
XmlRole {name: wait; query: "@wait/string()"}
}
QTCreator 错误:
file:///home/(...)/3queue-client-list.qml:42 XmlListModel is not a type
/home/(...)/Qt5.0.1/5.0.1/gcc/bin/qmlscene exited with code 255