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. Creating a complex List Model in QML

Creating a complex List Model in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qtquick2listviewlistmodel
1 Posts 1 Posters 647 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.
  • P Offline
    P Offline
    pra7
    wrote on last edited by
    #1

    I am using a ListView to display data. For that I use Component as a delegate and ListModel as the model to create rows in the ListView:

    Below image is the use case for the design:

    enter image description here

    I use a function to create the model based on the data received from the C++. But since rows and columns are dynamic and also each small box as a checkbox to display I am not getting how to populate/create a model for this.

    ListModel{
        id:myListModel
    }
    
    function createModel(){
        for(var rows = 0 ; rows < 10; rows++)
        {
            ListModel.append({}) //How to add data to model like a group based on the row and col ?
        }
    }
    

    As each small rectangle as checkboxes and columns are dynamic how to append data to the ListModel?

    Please Suggest.

    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