How to alias an array based property in qml?
-
I have property called
property var playerControls: [ playerControl1, playerControl2 ]
How can i alias an array based property and use in a for loop in other qml file iterating between my playerControls. Thanks in advance.
-
Did you try defining the alias ? What is the difficulty you faced ? You can check this.
Window { visible: true width: 440 height: 480 title: qsTr("http://www.pthinks.com") property alias jennyList: r1.mylist Rectangle{ id : r1 anchors.fill: parent;color :"blue" property var mylist :["dheeru","guru","Shreepoorna"] } MouseArea{ anchors.fill: parent onClicked: { for(var i=0;i<jennyList.length;i++){ console.log(jennyList[i]) } } } }
-
Yes, i have an array based access to playerControl instances inside my qml file as follows.
property var playerControls: [ playerControl1, playerControl2 ]
I have to make an alias to the above property which will also be same as the above list so that i can use them as follows in the top level qml files with the above component inside.
Component { id: chControlComponent multiControl { id: mrc playerControl1.visible: true playerControl2.visible: true ... ... ... }