Reputation: 304
I have a ScrollView which contains several draggable rectangles.
When I drag an item outside of that ScrollView, I want it to remain visible, but it gets clipped at the edge of the ScrollView.
I tried playing around with the z values, but it has absolutely no effect. Any idea on what else I could try?
Upvotes: 0
Views: 750
Reputation: 4484
You need to change the rectangles' parent to the parent of ScrollView
when the rectangle been dragged.
And if you want the rectangle always stay out of ScrollView after drag, assign a new state after the mouse release instead of when: dragMe.drag.active
.
Item{
id: root
width: 500
height: 500
ScrollView {
width: 200
height: 200
Item{
width: 500
height: 500
Rectangle{
id: rect
color: "red"
width: 50
height: 50
MouseArea{
id: dragMe
drag.target: parent
anchors.fill: parent
}
states: State {
when: dragMe.drag.active
ParentChange { target: rect; parent: root }
}
}
}
}
}
Upvotes: 1