Find child out of components and gridlayout in my qml file.
-
I have my function in player.qml (uppermost qml file) as follows:
Item { id: contractionPlayer .... .... .... function passInfoToVisibilityCheck(chIdx, contractionIdx) { for(var i = 0; i<parent.children.length; i++) { var child = children[i]; console.log("var child is ",child); } } ... ... ... ... ... Component { /*Replacing the channel labels in the previous design with the action buttons for 4 channels*/ id: chLabelComponent actionButton{ id: chTextButton ... ... ``` } Component { id: chMultiControlComponent multiControl { id: mc .... .... .... } GridLayout { id: layout anchors.fill: parent columns: 2 .... .... .... .... } } Inside my function when I try to find the hildren, i am unable to see the multiControl component with id: mc among them. How can i expose my component to be sen inside my child variable? Thanks in advance. -
You have not created the objects of component. Children means objects. Firs crate the object of components.
What are you trying to achieve ? -
Yes, now it is working.
Now my function is as follows:
function passInfoToBtnVisibilityCheck(chIdx, contractionIdx) { for (var row = 0; row < 4; row++) { for (var col = 1; col < 2; col++) { layout.children[row * layout.columns + col].item.playerControl1.lowerButton.visible = false; layout.children[row * layout.columns + col].item.playerControl1.upperButton.visible = false; layout.children[row * layout.columns + col].item.playerControl2.lowerButton.visible = false; layout.children[row * layout.columns + col].item.playerControl2.upperButton.visible = false; } } }I am able to access my
multiControl componentwith playerControls which is a child and also it is inside my gridlayout (with two columns(0 and 1) ) at column 1.