Hi,
i am trying to extend a qml item (in this case a flickable) with a method that logs a property of its children.
It seems not to work, when I click, the function is executed but I get only one item and it is not one of the children.
Application Output :
qml: item 0
qml: undefined
from the code below:
import QtQuick 2.2
..... some qml items.....
Flickable {
id: flicktest
x:0
y:0
width: 100
height: 100
contentWidth: 200
contentHeight: 200
function logallitems()
{
for (var i = 0; i < children.length; i++)
{
console.log("item "+i);
console.log(children[i].propname);
}
}
Text{
id: dummy1
x: 10
y: 10
property string propname :"hey1"
text: propname + " !!"
}
Text{
id: dummy2
x: 10
y: 30
property string propname :"hey2"
text: propname + " !!"
}
Text{
id: dummy3
x: 10
y: 50
property string propname :"hey3"
text: propname + " !!"
}
MouseArea{
anchors.fill: parent
onClicked: { flicktest.logallitems() ;}
}
}
.... other items
Does any of you experts know how to do this the right way ?
↧