1

我在 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
4

1 回答 1

7

导入 QtQuick.XmlListModel 2.0

于 2013-05-07T13:38:57.087 回答