I want to be able to print the height/width of the Flickable
view while dragging it. I believe it can be done using onDraggingChanged
or onMovingChanged
, since a similar event listener onTextChanged
does the job of listening text changes in text controls.
I tried this:
Flickable{
id: flick
height: parent.height - 40
width: parent.width - 40
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: 20
flickableDirection: Flickable.HorizontalAndVerticalFlick
Rectangle{
anchors.fill: parent
color: "steelblue"
}
onMovingChanged: {
console.log("onMovingChanged")
console.log("height:", height)
}
onDraggingChanged: {
console.log("onDraggingChanged")
console.log("height:", height)
}
}
But those event listeners will only print the height on the start and end of dragging/moving the flickable. So how do I achieve this?
I believe Flickable.contentXChanged
and Flickable.contentYChanged
signals are what you need.
Flickable.draggingChanged
is emitted only when drag is starting and ending.Flickable.movingChanged
is emitted only when Flickable starts and ends moving.Flickable.contentXChanged
is emitted every time content is being moved horizontally.Flickable.contentYChanged
is emitted every time content is being moved vertically.Also Text.textChanged
is emitted every time text changes.