Unsolved QML ListVIew Elements
-
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