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. Display Array of Objects in Column
Forum Updated to NodeBB v4.3 + New Features

Display Array of Objects in Column

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 245 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.
  • S Offline
    S Offline
    sandro4912
    wrote on last edited by
    #1

    So I have A Column like this:

        SystemInformation{
            id: sysinfo
        }
    
        Column{
    
    //...
            CPUUtilizationDisplay{
                width: root.elementWidth
                height: root.elementHeight
    
                value: sysinfo.cpuUtilizationInPercent
            }
            CoreUtilizationDisplay{
                width: root.elementWidth
                height: root.elementHeight
                core: 1 
    //...
            }
            CoreUtilizationDisplay{
                width: root.elementWidth
                height: root.elementHeight
                core: 2
    //...
            }
    
    //...
    }
    

    Now my problem is I only now after startup how many CoreUtilizationDisplay Objects I need when the sysinfo can tell me how many cores the system has. So the count of Elements of type CoreUtilizationDisplay is only nowable at run time. How can I achieve to display them?

    Sysinfo gives me an array of doubles and I need to create for each element one CoreUtilizationDisplay.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sandro4912
      wrote on last edited by
      #2

      Could solve it myself:

          Repeater{
              model: sysinfo.coreUtilizationsInPercent.length
      
              CoreUtilizationDisplay{
                  width: root.elementWidth
                  height: root.elementHeight
                  core: index + 1
      
                  value: sysinfo.coreUtilizationsInPercent[index]
      
                  progressBarColor: "#3399FF" // blue
                  minMaxTextColor: "blue"
              }
          }
      

      I thought I need to create the Objects dynamically. But since I know the count of cores at startup I can just use Repeater

      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