Skip to content

Touch & gestures

veriCue synthesizes real Qt touch events - TouchBegin / TouchUpdate / TouchEnd sequences with correctly mapped local, scene, and global coordinates. Gestures work identically on QWidget and QML/Qt Quick targets: handlers build platform-neutral touch points and only the QPA boundary constructs the final Qt event, so the same test drives both UI stacks on Qt 5.15 and Qt 6.

All commands take a path to the target object. Coordinates are local to the target; when x/y are omitted, the target's center is used.

touch_tap

A single finger press-and-release.

ParamTypeDefaultMeaning
pathstring-Target object
x, yintcenterTap position (local coords)
durationint50Hold time in ms between press and release
python
await client.touch_tap("MainWindow/canvas")
await client.touch_tap("MainWindow/canvas", x=10, y=20, duration=100)
csharp
await client.TouchTapAsync("MainWindow/canvas", durationMs: 100);

touch_long_press

Same as touch_tap with a longer default hold - use it to trigger long-press context menus and press-and-hold interactions.

ParamTypeDefault
pathstring-
x, yintcenter
durationint800
python
await client.touch_long_press("MainWindow/listView", x=50, y=120)

swipe

A one-finger drag from one point to another, interpolated over stepsTouchUpdate events spread across duration milliseconds.

ParamTypeDefaultMeaning
pathstring-Target object
from_x, from_yintrequiredStart position
to_x, to_yintrequiredEnd position
durationint300Total gesture time in ms
stepsint10Number of interpolated move events
python
# Scroll a list upward by swiping from bottom to top
await client.swipe("MainWindow/listView", 100, 400, 100, 50)

# Slow, fine-grained swipe for drag-sensitive widgets
await client.swipe("MainWindow/slider", 0, 20, 200, 20, duration=800, steps=40)
csharp
await client.SwipeAsync("MainWindow/listView", 100, 400, 100, 50);

Increase steps when the widget under test tracks velocity or reacts to intermediate positions (kinetic scrolling, drag thresholds).

pinch

A two-finger pinch/zoom, optionally with rotation. Two touch points start start_distance apart, centered on the target (or on center_x/center_y), and move to end_distance apart while rotating by rotation degrees.

ParamTypeDefaultMeaning
pathstring-Target object
start_distanceintrequiredInitial finger separation (px, must be > 0)
end_distanceintrequiredFinal finger separation (px, must be > 0)
center_x, center_yinttarget centerGesture center
rotationdouble0.0Total rotation in degrees
durationint300Total gesture time in ms
stepsint10Interpolated move events

The response includes the effective scale (end_distance / start_distance).

python
# Zoom in 2x
await client.pinch("MainWindow/mapView", start_distance=100, end_distance=200)

# Zoom out while rotating 45°
await client.pinch("MainWindow/mapView", start_distance=200,
                   end_distance=100, rotation=45.0)
csharp
await client.PinchAsync("MainWindow/mapView", startDistance: 100, endDistance: 200);

multi_touch

Low-level access for arbitrary multi-finger interactions. You send one command per frame; each command carries the full set of active touch points.

ParamTypeMeaning
pathstringTarget object
touchesarrayOne object per finger: {id, x, y, action}

action is one of press, move, release. The event type is derived from the combined actions: any pressTouchBegin, all releaseTouchEnd, otherwise TouchUpdate. Keep id stable per finger across frames.

python
# Two-finger tap
await client.multi_touch("MainWindow/canvas", [
    {"id": 0, "x": 100, "y": 100, "action": "press"},
    {"id": 1, "x": 200, "y": 100, "action": "press"},
])
await client.multi_touch("MainWindow/canvas", [
    {"id": 0, "x": 100, "y": 100, "action": "release"},
    {"id": 1, "x": 200, "y": 100, "action": "release"},
])

Errors

  • 2001 object_not_found - the path did not resolve, or the target was destroyed mid-gesture. Timed gestures (swipe, pinch, taps with a hold) run the Qt event loop between steps; if the interaction closes the widget (e.g. a tap dismisses a dialog), the gesture aborts safely with this error instead of touching a dead object.
  • 2004 widget_not_visible / 2005 widget_not_enabled - target failed visibility/enabled validation at resolve time.
  • 1004 invalid_params - missing required coordinates, non-positive steps/distances, or a malformed touches array.

QML notes

Touch events for Qt Quick items are delivered with scene coordinates to the owning QQuickWindow, matching how real touch input is dispatched - so MultiPointTouchArea, PinchArea, and Flickable behave exactly as they do under a finger.

Released under a commercial licence. Privacy · Terms