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
toucheventsequence.qdoc
Go to the documentation of this file.
1// Copyright (C) 2016 Jeremy Katz
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \qmltype TouchEventSequence
6 \inqmlmodule QtTest
7 \ingroup qtquicktest
8 \brief TouchEventSequence is used to build and dispatch touch events
9 for testing.
10
11 \since 5.9
12
13 A TouchEventSequence is created by calling \l [QML] {TestCase::touchEvent()}{TestCase.touchEvent()}.
14 The type can not be directly instantiated. Each method provided by the type returns
15 the same object, allowing chained calls.
16
17 For example:
18 \code
19 touchEvent(item).press(0).commit();
20 \endcode
21 is equivalent to:
22 \code
23 var sequence = touchEvent(item);
24 sequence.press(0);
25 sequence.commit();
26 \endcode
27
28 Events are delivered to the window which contains the item specified in touchEvent.
29
30 \sa TestCase::touchEvent()
31*/
32
33/*!
34 \qmlmethod TouchEventSequence TouchEventSequence::press(int touchId, object item, real x = item.width / 2, real y = item.height / 2)
35
36 Creates a new point identified as \a touchId, at the point indicated by \a x and \a y relative to \a item.
37 Further use of the same touch point should maintain the same touchId.
38
39 Item defaults to the value provided via touchEvent().
40 X and y default to the midpoint of the item.
41*/
42
43/*!
44 \qmlmethod TouchEventSequence TouchEventSequence::move(int touchId, object item, real x = item.width / 2, real y = item.height / 2)
45
46 Moves \a touchId to the point indicated by \a x and \a y relative to \a item.
47
48 Item defaults to the value provided via touchEvent().
49 X and y default to the midpoint of the item.
50*/
51
52/*!
53 \qmlmethod TouchEventSequence TouchEventSequence::release(int touchId, object item, real x = item.width / 2, real y = item.height / 2)
54
55 Removes \a touchId at the point indicated by \a x and \a y relative to \a item.
56
57 Item defaults to the value provided via touchEvent().
58 X and y default to the midpoint of the item.
59*/
60
61/*!
62 \qmlmethod TouchEventSequence TouchEventSequence::stationary(int touchId)
63
64 Indicates that \a touchId is present but otherwise unchanged from prior events.
65*/
66
67/*!
68 \qmlmethod TouchEventSequence TouchEventSequence::commit()
69
70 Sends the touch event composed by prior use of press(), move(), release(), and stationary().
71 Following commit's return, the TouchEventSequence can be used to compose a new event.
72
73 \code
74 var sequence = touchEvent(target);
75 // Touch the middle of target with 1 point
76 sequence.press(1);
77 sequence.commit();
78
79 // Begin a new event
80 // Move the point to target's upper left corner
81 sequence.move(1, target, 0, 0);
82 sequence.commit();
83 \endcode
84
85 Commit is automatically invoked when the TouchEventSequence object is destroyed.
86*/