Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
Two touchpoints dragging two DragHandlers

In Dragging one DragHandler with one touchpoint we began with a detailed tour through the event delivery logic while one Rectangle is being dragged on a touchscreen with one finger. Let's now delve into parallel delivery: two fingers dragging two Rectangles, each with its own DragHandler, on a touchscreen.

import QtQuick
Rectangle {
id: root
width: 400
height: 400
color: ph.active ? "aquamarine" : "beige"
PinchHandler {
id: ph
grabPermissions: PointerHandler.TakeOverForbidden
}
Rectangle {
objectName: "rect1"
x: 50
width: 100
height: 100
color: dh1.active ? "tomato" : "wheat"
DragHandler {
id: dh1
objectName: "dh1"
}
}
Rectangle {
objectName: "rect2"
x: 250
width: 100
height: 100
color: dh2.active ? "tomato" : "lightsteelblue"
DragHandler {
id: dh2
objectName: "dh2"
}
}
Rectangle {
objectName: "rect3"
x: 150
y: 150
width: 100
height: 100
color: dh3.active ? "tomato" : "darksalmon"
DragHandler {
id: dh3
objectName: "dh3"
}
}
}
dragging two rectangles via touch

Dragging two DragHandlers with two fingers

The user presses two fingers on two of the small Rectangles simultaneously. ① A QTouchEvent arrives, it contains two QEventPoints, and we have to decide which items and handlers we're going to visit.

TODO continue

In summary, the DragHandlers take and hold exclusive grabs on the two touchpoints, preventing the PinchHandler on the underlying Rectangle from activating. But how can the user activate it then? Find out in the next chapter: Pinch on a touchscreen