PDA

View Full Version : Flickable



Binary01
18th February 2016, 17:05
Hiii everyOne,

See the code below:

Item{
width: 600
height: 500

Rectangle{
width: parent.width
height: 400
color: "#710909"
anchors.bottom: parent.bottom
Flickable{
anchors.fill: parent
contentWidth: parent.width
contentHeight: parent.height*3
Rectangle {
id: GreenRectangle
x: 200
y: 106
width: 200
height: 200
color: "green"
}
}
}
}

Why the object GreenRectangle exceeds the limit of Flickable ... see image : 11719
Any solution ?

anda_skoa
18th February 2016, 17:18
The Flickable's default boundsBehavior is Flickable.DragAndOvershootBounds (default) - the contents can be dragged beyond the boundary of the Flickable, and can overshoot the boundary when flicked.

Also clipping is off by default.

Cheers,
_

Binary01
18th February 2016, 17:35
Is there a way to stop GreenRectangle at the bound of Flickable (we can see GreenRectangle)
Cheers,

anda_skoa
18th February 2016, 17:43
That doesn't sound like you have tried changing the boundsBehavior.
Have you?

Cheers,
_

Binary01
18th February 2016, 17:59
Yes I tried,


Flickable{
boundsBehavior: Flickable.StopAtBounds
anchors.fill: parent
contentWidth: parent.width
contentHeight: parent.height*2
clip: true

I want to disable the flick when the green rectangle reaches the top like : 11720