Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML ListVIew Elements
Qt 6.11 is out! See what's new in the release blog

QML ListVIew Elements

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 561 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.
  • G Offline
    G Offline
    geageagea
    wrote on last edited by
    #1

    Hi there,
    I'm using a ListView to display a list of Text with a CheckBox. I have another button that selects/deselects all items on the list when pressed. The selection function searches for all the list view's children and checks the one that are check boxes. The problem I'm having is that when the list has too many items, the function doesn't selects all. It only selects the ones that are been displayed and a few more. I think qt is loading the displayed items dynamically and they aren't all instantiated.

    When pressing the button:

    onPressed {
      checkChild(configList) // configList is the ListView element
    }
    
    function checkChild(currentItem)
    {
        if(isCheckBox(currentItem))
        {
            currentItem.checked = forceCheck
        }
    
        for(var i = 0; i < currentItem.children.length; i++)
        {
            checkChild(currentItem.children[i])
        }
    }
    
    function isCheckBox(currentItem)
    {
        return (undefined !== currentItem.objectName && currentItem.objectName === "checkBox" && undefined !== currentItem.checked)
    }
    

    Every CheckBox element has the objectName property set to "checkBox"
    Has anyone an idea on how to force the selection to every element instead of the ones dynamically loaded to RAM?
    Thanks in advance
    Best regards

    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