我在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
答案 0 :(得分:6)
导入QtQuick.XmlListModel 2.0