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
    @<xml>
    <item>
    <description locale="en">....</description>
    <description locale="ru">....</description>
    <description locale="it">....</description>
    </item>
    <xml>@

    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 http://bugreports.qt.nokia.com so that it works automatically in future versions.

    Regards,
    Michael


Log in to reply
 

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