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. Dynamic listview from json
Qt 6.11 is out! See what's new in the release blog

Dynamic listview from json

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

    Hi everyone, I was wondering if someone could help me create a listview with a QAbstractListModel attached that reads a json file that contains an array of (equal) objects and automatically sets the column names from the keys of the objects and the rows from the content of the array. Is is possible to do that? I can't wrap my head around on how to structure it

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      You might wanna have a look at the document viewer example.
      It reads any JSON file and displays it in a tree model.
      If your JSON is always a specific array, you can easily plumb that into a list view.

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      2
      • GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        https://github.com/benlau/qsyncable does that

        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