XmlRole boolean(@something) not working

  • Hi all,
    I couldn't reproduce the example given in the Qt doc about XmlRole for the boolean (here : http://doc.qt.io/qt-5/qml-qtquick-xmllistmodel-xmlrole.html).

    I want to use a boolean like it is given in the QtDoc example :

        <book type="Online" wanted="true">
        // query the wanted attribute as a boolean
        XmlRole { name: "wanted"; query: "boolean(@wanted)" }
    ListView {
        width: 300; height: 200
        model: model
        delegate: Column {
            Text { text: title + " (" + type + ")"; font.bold: wanted }

    But it's not giving me a bool. I found a way to solve my problem :

     XmlRole { name: "lighton"; query: "@on/string()" }
    visible: lighton==="true"

    I hope that this will help other people not spending so much time in that issue.


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.