Yes:, my code looks like that:
Rectangle{
id: developpmentView
Item{
id: application
Rectangle{
id: draggableItem
...
}
}
Button{
text: "Debug"
property bool activeDebug: false
onClicked: {
if( !activeDebug ){
activeDebug = true
debugLoader.sourceComponent = debugItem
}else{
activeDebug = false
debugLoader.sourceComponent = undefined
}
}
}
Loader: {
id: debugLoader
}
Component{
id: debugItem
Rectangle{
id: debugZone
anchors.fill: parent
z: 10
opacity: 0.3
color: "lightBlue"
states: State{
name: "reparented"
ParentChange{
target: debugZone
(1) parent: draggableItem
(2) x: draggableItem.x
(3) y: draggableItem.y
(4) width: draggableItem.width
(5) height: draggableItem.height
(6) scale: draggableItem.scale
}
Component.onCompleted: {
debugZone.state = "reparented"
}
}
}
}
}
This works, but if I move all my developpementView to an other file, I have this message:
line (1): ReferenceError: draggableItem is not defined
For lines 2, 3, …, 6, I can write alias to access to these properties, but for the parent, I don’t know how to make.
↧