Add or Change XmlRole in XmlListModel

  • Hi all, can somebody tell how i can change query in XmlRole or add new, into XmlListModel in run time.
    for example i have such xml
    <description locale="en">....</description>
    <description locale="ru">....</description>
    <description locale="it">....</description>

    In qml i have such model
    XmlListModel {
    id: xmlModel
    source: ""
    query: "/"

         XmlRole { name: "Note"; query: "description[@locale=".."]/string()" }

    i tried make like this query: "description[@locale=" + locale + " ] /string()", and then from c++ set ContextProperty, but this not working.
    Any help ?

  • Hi,

    Unfortunately at the moment you'll probably need a manual call to reload() on the XmlListModel to force the new information (role/query) to be used. I'd suggest filing a bug/suggestion for this on so that it works automatically in future versions.


Log in to reply

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