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. List Model How to Append data

List Model How to Append data

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 777 Views
  • 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.
  • H Offline
    H Offline
    haris123
    wrote on last edited by
    #1

    I have my list mode

    @ ListModel {
    id: nestedModel
    }@

    and I can append the list model using the code

    @nestedModel.append({
    locationName: qsTr("Location5"),
    collapsed: true,
    folders: [{
    folderName: qsTr("Cam11")
    }, {
    folderName: qsTr("Cam22")
    }, {
    folderName: qsTr("Cam33")
    }, {
    folderName: qsTr("Cam44")
    }]
    })@

    Which works fine.

    But I need to append the inner list only using the same append model, like I have already "Cam11,Cam22,Cam33,Cam44" in my list model, and I have to append "Cam55,Cam66" dynamically.

    How it's possible?

    Any help will be appreciated...

    Thanks
    Haris

    1 Reply Last reply
    0
    • H Offline
      H Offline
      haris123
      wrote on last edited by
      #2

      Finally I found the answer "here":http://www.codeproject.com/Articles/632795/QML-TreeModel-and-TreeView
      We can append new data to child list using

      @nestedModel.get(index).folders.append({"folderName": "Cam55})
      nestedModel.get(index).folders.append({"folderName": "Cam66})@
      
      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