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. Sending XmlListModel contents to a database

Sending XmlListModel contents to a database

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 1.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.
  • J Offline
    J Offline
    jordanmt
    wrote on last edited by
    #1

    Hi all,

    I'm learning as I go along. Mucking around with QML and javscript.

    Currently I have an XmlListModel that populates a ListView. I want to send that xml data (about 100 entries) to be stored using javascript and sqlite.

    Originally I thought I could store the xml data by calling a javscript function (e.g. saveItem(model);) within the ListView -- this would work for any visible list items, but wouldn't commit the entire list because the function was only being called as each list item was created (i.e. as I scroll).

    What would be the best way to send the contents of my XmlListModel to a database?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      ravirdv
      wrote on last edited by
      #2

      Hi,

      I had the same issue, I came across a js library called "persistencejs". It works with QML so you can give it a try.

      lib -> http://persistencejs.org/

      use this for reference https://github.com/fgrehm/QtGas

      1 Reply Last reply
      0
      • O Offline
        O Offline
        oniongarlic
        wrote on last edited by
        #3

        I was doing something similar, but in the end decided to use load my xml using XMLHttpRequest, pick the data I needed from the xml dom result into a database and the load the data from the database into my model when needed. A bit more work, but if the XML is even a bit more complex then the XmlListModel can't handle it (lists inside lists for example).

        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