Handle touch event and flicks simultaneously in Qml
-
I'm trying to write UI on Qml with two capabilities:
-
handle touch event (to choose some object)
-
handle flick events (to view some large object)
It's my code:
@Rectangle {
width: 500; height: 500
Flickable {
anchors.fill: parentonContentXChanged: { console.log("x changed") //redraw large object MouseArea { anchors.fill: parent preventStealing: true onClicked: { console.log("clicked") //choose some object } }
}@
I have two problems:
-
On Android clicked events don't appear (even with preventStealing property)
-
How can I differ short touch (clicked) event from pressing+dragging+releasing? As I understand, MouseArea must send clicked event in both cases.
-
-
You have missed setting contentHeight and contentWidth in your Flickable. That is probably why the MouseArea does not respond: it's size might be 0x0.
-
Yes, make your MouseArea smaller ;) After all, your selectable items will not occupy the whole content area?
Also, you might consider using this to pass the even to the Flickable:
@
MouseArea {
anchors.fill: parent
preventStealing: trueonClicked: { console.log("clicked") mouse.accepted = false // or: event.accepted = false } }
@