Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Add or Change XmlRole in XmlListModel
Forum Updated to NodeBB v4.3 + New Features

Add or Change XmlRole in XmlListModel

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxvanceffer
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved