OpenCoverage

qquickmultipointtoucharea.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickmultipointtoucharea.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qquickmultipointtoucharea_p.h"-
41#include <QtQuick/qquickwindow.h>-
42#include <private/qsgadaptationlayer_p.h>-
43#include <private/qquickitem_p.h>-
44#include <private/qguiapplication_p.h>-
45#include <QEvent>-
46#include <QMouseEvent>-
47#include <QDebug>-
48#include <qpa/qplatformnativeinterface.h>-
49-
50QT_BEGIN_NAMESPACE-
51-
52DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING)
never executed: status = Yes;
never executed: end of block
executed 8 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
executed 62 times by 4 tests: return status == Yes;
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
status == UnknownDescription
TRUEevaluated 8 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
FALSEevaluated 54 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
__builtin_expe...ING")), false)Description
TRUEnever evaluated
FALSEevaluated 8 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
v != "0"Description
TRUEnever evaluated
FALSEnever evaluated
v != "false"Description
TRUEnever evaluated
FALSEnever evaluated
0-62
53-
54/*!-
55 \qmltype TouchPoint-
56 \instantiates QQuickTouchPoint-
57 \inqmlmodule QtQuick-
58 \ingroup qtquick-input-events-
59 \brief Describes a touch point in a MultiPointTouchArea.-
60-
61 The TouchPoint type contains information about a touch point, such as the current-
62 position, pressure, and area.-
63-
64 \image touchpoint-metrics.png-
65*/-
66-
67/*!-
68 \qmlproperty int QtQuick::TouchPoint::pointId-
69-
70 This property holds the point id of the touch point.-
71-
72 Each touch point within a MultiPointTouchArea will have a unique id.-
73*/-
74void QQuickTouchPoint::setPointId(int id)-
75{-
76 if (_id == id)
_id == idDescription
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 186 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
70-186
77 return;
executed 70 times by 3 tests: return;
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
70
78 _id = id;-
79 emit pointIdChanged();-
80}
executed 186 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
186
81-
82/*!-
83 \qmlproperty real QtQuick::TouchPoint::x-
84 \qmlproperty real QtQuick::TouchPoint::y-
85-
86 These properties hold the current position of the touch point.-
87*/-
88-
89void QQuickTouchPoint::setX(qreal x)-
90{-
91 if (_x == x)
_x == xDescription
TRUEevaluated 214 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 284 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
214-284
92 return;
executed 214 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
214
93 _x = x;-
94 emit xChanged();-
95}
executed 284 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
284
96-
97void QQuickTouchPoint::setY(qreal y)-
98{-
99 if (_y == y)
_y == yDescription
TRUEevaluated 244 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 254 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
244-254
100 return;
executed 244 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
244
101 _y = y;-
102 emit yChanged();-
103}
executed 254 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
254
104-
105/*!-
106 \qmlproperty size QtQuick::TouchPoint::ellipseDiameters-
107 \since 5.9-
108-
109 This property holds the major and minor axes of the ellipse representing-
110 the covered area of the touch point.-
111*/-
112void QQuickTouchPoint::setEllipseDiameters(const QSizeF &d)-
113{-
114 if (_ellipseDiameters == d)
_ellipseDiameters == dDescription
TRUEevaluated 380 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 106 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
106-380
115 return;
executed 380 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
380
116 _ellipseDiameters = d;-
117 emit ellipseDiametersChanged();-
118}
executed 106 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
106
119-
120/*!-
121 \qmlproperty real QtQuick::TouchPoint::pressure-
122 \qmlproperty vector2d QtQuick::TouchPoint::velocity-
123-
124 These properties hold additional information about the current state of the touch point.-
125-
126 \list-
127 \li \c pressure is a value in the range of 0.0 to 1.0.-
128 \li \c velocity is a vector with magnitude reported in pixels per second.-
129 \endlist-
130-
131 Not all touch devices support velocity. If velocity is not supported, it will be reported-
132 as 0,0.-
133*/-
134void QQuickTouchPoint::setPressure(qreal pressure)-
135{-
136 if (_pressure == pressure)
_pressure == pressureDescription
TRUEevaluated 286 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 200 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
200-286
137 return;
executed 286 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
286
138 _pressure = pressure;-
139 emit pressureChanged();-
140}
executed 200 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
200
141-
142/*!-
143 \qmlproperty real QtQuick::TouchPoint::rotation-
144 \since 5.9-
145-
146 This property holds the angular orientation of this touch point. The return-
147 value is in degrees, where zero (the default) indicates the finger or token-
148 is pointing upwards, a negative angle means it's rotated to the left, and a-
149 positive angle means it's rotated to the right. Most touchscreens do not-
150 detect rotation, so zero is the most common value.-
151-
152 \sa QTouchEvent::TouchPoint::rotation()-
153*/-
154void QQuickTouchPoint::setRotation(qreal r)-
155{-
156 if (_rotation == r)
_rotation == rDescription
TRUEevaluated 486 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-486
157 return;
executed 486 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
486
158 _rotation = r;-
159 emit rotationChanged();-
160}
never executed: end of block
0
161-
162void QQuickTouchPoint::setVelocity(const QVector2D &velocity)-
163{-
164 if (_velocity == velocity)
_velocity == velocityDescription
TRUEevaluated 486 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-486
165 return;
executed 486 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
486
166 _velocity = velocity;-
167 emit velocityChanged();-
168}
never executed: end of block
0
169-
170/*!-
171 \deprecated-
172 \qmlproperty rectangle QtQuick::TouchPoint::area-
173-
174 A rectangle covering the area of the touch point, centered on the current-
175 position of the touch point.-
176-
177 It is deprecated because a touch point is more correctly modeled as an ellipse,-
178 whereas this rectangle represents the outer bounds of the ellipse after \l rotation.-
179*/-
180void QQuickTouchPoint::setArea(const QRectF &area)-
181{-
182 if (_area == area)
_area == areaDescription
TRUEevaluated 166 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 320 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
166-320
183 return;
executed 166 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
166
184 _area = area;-
185 emit areaChanged();-
186}
executed 320 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
320
187-
188/*!-
189 \qmlproperty bool QtQuick::TouchPoint::pressed-
190-
191 This property holds whether the touch point is currently pressed.-
192*/-
193void QQuickTouchPoint::setPressed(bool pressed)-
194{-
195 if (_pressed == pressed)
_pressed == pressedDescription
TRUEnever evaluated
FALSEevaluated 288 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
0-288
196 return;
never executed: return;
0
197 _pressed = pressed;-
198 emit pressedChanged();-
199}
executed 288 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
288
200-
201/*!-
202 \qmlproperty real QtQuick::TouchPoint::startX-
203 \qmlproperty real QtQuick::TouchPoint::startY-
204-
205 These properties hold the starting position of the touch point.-
206*/-
207-
208void QQuickTouchPoint::setStartX(qreal startX)-
209{-
210 if (_startX == startX)
_startX == startXDescription
TRUEevaluated 354 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 144 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
144-354
211 return;
executed 354 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
354
212 _startX = startX;-
213 emit startXChanged();-
214}
executed 144 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
144
215-
216void QQuickTouchPoint::setStartY(qreal startY)-
217{-
218 if (_startY == startY)
_startY == startYDescription
TRUEevaluated 360 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 138 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
138-360
219 return;
executed 360 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
360
220 _startY = startY;-
221 emit startYChanged();-
222}
executed 138 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
138
223-
224/*!-
225 \qmlproperty real QtQuick::TouchPoint::previousX-
226 \qmlproperty real QtQuick::TouchPoint::previousY-
227-
228 These properties hold the previous position of the touch point.-
229*/-
230void QQuickTouchPoint::setPreviousX(qreal previousX)-
231{-
232 if (_previousX == previousX)
_previousX == previousXDescription
TRUEevaluated 250 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 248 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
248-250
233 return;
executed 250 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
250
234 _previousX = previousX;-
235 emit previousXChanged();-
236}
executed 248 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
248
237-
238void QQuickTouchPoint::setPreviousY(qreal previousY)-
239{-
240 if (_previousY == previousY)
_previousY == previousYDescription
TRUEevaluated 278 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 220 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
220-278
241 return;
executed 278 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
278
242 _previousY = previousY;-
243 emit previousYChanged();-
244}
executed 220 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
220
245-
246/*!-
247 \qmlproperty real QtQuick::TouchPoint::sceneX-
248 \qmlproperty real QtQuick::TouchPoint::sceneY-
249-
250 These properties hold the current position of the touch point in scene coordinates.-
251*/-
252-
253void QQuickTouchPoint::setSceneX(qreal sceneX)-
254{-
255 if (_sceneX == sceneX)
_sceneX == sceneXDescription
TRUEevaluated 214 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 284 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
214-284
256 return;
executed 214 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
214
257 _sceneX = sceneX;-
258 emit sceneXChanged();-
259}
executed 284 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
284
260-
261void QQuickTouchPoint::setSceneY(qreal sceneY)-
262{-
263 if (_sceneY == sceneY)
_sceneY == sceneYDescription
TRUEevaluated 244 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 254 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
244-254
264 return;
executed 244 times by 2 tests: return;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
244
265 _sceneY = sceneY;-
266 emit sceneYChanged();-
267}
executed 254 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
254
268-
269/*!-
270 \qmlproperty PointingDeviceUniqueId QtQuick::TouchPoint::uniqueId-
271 \since 5.9-
272-
273 This property holds the unique ID of the touch point or token.-
274-
275 It is normally empty, because touchscreens cannot uniquely identify fingers.-
276 But when it is set, it is expected to uniquely identify a specific token-
277 (fiducial object).-
278-
279 Interpreting the contents of this ID requires knowledge of the hardware and-
280 drivers in use (e.g. various TUIO-based touch surfaces).-
281*/-
282void QQuickTouchPoint::setUniqueId(const QPointingDeviceUniqueId &id)-
283{-
284 _uniqueId = id;-
285 emit uniqueIdChanged();-
286}
executed 486 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
486
287-
288-
289/*!-
290 \qmltype GestureEvent-
291 \instantiates QQuickGrabGestureEvent-
292 \inqmlmodule QtQuick-
293 \ingroup qtquick-input-events-
294 \brief The parameter given with the gestureStarted signal.-
295-
296 The GestureEvent object has the current touch points, which you may choose-
297 to interpret as a gesture, and an invokable method to grab the involved-
298 points exclusively.-
299*/-
300-
301/*!-
302 \qmlproperty real QtQuick::GestureEvent::dragThreshold-
303-
304 This property holds the system setting for the distance a finger must move-
305 before it is interpreted as a drag. It comes from-
306 QStyleHints::startDragDistance().-
307*/-
308-
309/*!-
310 \qmlproperty list<TouchPoint> QtQuick::GestureEvent::touchPoints-
311-
312 This property holds the set of current touch points.-
313*/-
314-
315/*!-
316 \qmlmethod QtQuick::GestureEvent::grab()-
317-
318 Acquires an exclusive grab of the mouse and all the \l touchPoints, and-
319 calls \l {QQuickItem::setKeepTouchGrab()}{setKeepTouchGrab()} and-
320 \l {QQuickItem::setKeepMouseGrab()}{setKeepMouseGrab()} so that any-
321 parent Item that \l {QQuickItem::filtersChildMouseEvents()}{filters} its-
322 children's events will not be allowed to take over the grabs.-
323*/-
324-
325/*!-
326 \qmltype MultiPointTouchArea-
327 \instantiates QQuickMultiPointTouchArea-
328 \inqmlmodule QtQuick-
329 \inherits Item-
330 \ingroup qtquick-input-
331 \brief Enables handling of multiple touch points.-
332-
333-
334 A MultiPointTouchArea is an invisible item that is used to track multiple touch points.-
335-
336 The \l Item::enabled property is used to enable and disable touch handling. When disabled,-
337 the touch area becomes transparent to mouse and touch events.-
338-
339 By default, the mouse will be handled the same way as a single touch point,-
340 and items under the touch area will not receive mouse events because the-
341 touch area is handling them. But if the \l mouseEnabled property is set to-
342 false, it becomes transparent to mouse events so that another-
343 mouse-sensitive Item (such as a MouseArea) can be used to handle mouse-
344 interaction separately.-
345-
346 MultiPointTouchArea can be used in two ways:-
347-
348 \list-
349 \li setting \c touchPoints to provide touch point objects with properties that can be bound to-
350 \li using the onTouchUpdated or onPressed, onUpdated and onReleased handlers-
351 \endlist-
352-
353 While a MultiPointTouchArea \e can take exclusive ownership of certain touch points, it is also possible to have-
354 multiple MultiPointTouchAreas active at the same time, each operating on a different set of touch points.-
355-
356 \sa TouchPoint-
357*/-
358-
359/*!-
360 \qmlsignal QtQuick::MultiPointTouchArea::pressed(list<TouchPoint> touchPoints)-
361-
362 This signal is emitted when new touch points are added. \a touchPoints is a list of these new points.-
363-
364 If minimumTouchPoints is set to a value greater than one, this signal will not be emitted until the minimum number-
365 of required touch points has been reached.-
366-
367 The corresponding handler is \c onPressed.-
368*/-
369-
370/*!-
371 \qmlsignal QtQuick::MultiPointTouchArea::updated(list<TouchPoint> touchPoints)-
372-
373 This signal is emitted when existing touch points are updated. \a touchPoints is a list of these updated points.-
374-
375 The corresponding handler is \c onUpdated.-
376*/-
377-
378/*!-
379 \qmlsignal QtQuick::MultiPointTouchArea::released(list<TouchPoint> touchPoints)-
380-
381 This signal is emitted when existing touch points are removed. \a touchPoints is a list of these removed points.-
382-
383 The corresponding handler is \c onReleased.-
384*/-
385-
386/*!-
387 \qmlsignal QtQuick::MultiPointTouchArea::canceled(list<TouchPoint> touchPoints)-
388-
389 This signal is emitted when new touch events have been canceled because another item stole the touch event handling.-
390-
391 This signal is for advanced use: it is useful when there is more than one MultiPointTouchArea-
392 that is handling input, or when there is a MultiPointTouchArea inside a \l Flickable. In the latter-
393 case, if you execute some logic in the \c onPressed signal handler and then start dragging, the-
394 \l Flickable may steal the touch handling from the MultiPointTouchArea. In these cases, to reset-
395 the logic when the MultiPointTouchArea has lost the touch handling to the \l Flickable,-
396 \c canceled should be handled in addition to \l released.-
397-
398 \a touchPoints is the list of canceled points.-
399-
400 The corresponding handler is \c onCanceled.-
401*/-
402-
403/*!-
404 \qmlsignal QtQuick::MultiPointTouchArea::gestureStarted(GestureEvent gesture)-
405-
406 This signal is emitted when the global drag threshold has been reached.-
407-
408 This signal is typically used when a MultiPointTouchArea has been nested in a Flickable or another MultiPointTouchArea.-
409 When the threshold has been reached and the signal is handled, you can determine whether or not the touch-
410 area should grab the current touch points. By default they will not be grabbed; to grab them call \c gesture.grab(). If the-
411 gesture is not grabbed, the nesting Flickable, for example, would also have an opportunity to grab.-
412-
413 The gesture object also includes information on the current set of \c touchPoints and the \c dragThreshold.-
414-
415 The corresponding handler is \c onGestureStarted.-
416*/-
417-
418/*!-
419 \qmlsignal QtQuick::MultiPointTouchArea::touchUpdated(list<TouchPoint> touchPoints)-
420-
421 This signal is emitted when the touch points handled by the MultiPointTouchArea change. This includes adding new touch points,-
422 removing or canceling previous touch points, as well as updating current touch point data. \a touchPoints is the list of all current touch-
423 points.-
424-
425 The corresponding handler is \c onTouchUpdated.-
426*/-
427-
428/*!-
429 \qmlproperty list<TouchPoint> QtQuick::MultiPointTouchArea::touchPoints-
430-
431 This property holds a set of user-defined touch point objects that can be bound to.-
432-
433 If mouseEnabled is true (the default) and the left mouse button is pressed-
434 while the mouse is over the touch area, the current mouse position will be-
435 one of these touch points.-
436-
437 In the following example, we have two small rectangles that follow our touch points.-
438-
439 \snippet qml/multipointtoucharea/multipointtoucharea.qml 0-
440-
441 By default this property holds an empty list.-
442-
443 \sa TouchPoint-
444*/-
445-
446QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)-
447 : QQuickItem(parent),-
448 _minimumTouchPoints(0),-
449 _maximumTouchPoints(INT_MAX),-
450 _stealMouse(false),-
451 _mouseEnabled(true)-
452{-
453 setAcceptedMouseButtons(Qt::LeftButton);-
454 setFiltersChildMouseEvents(true);-
455 if (qmlVisualTouchDebugging()) {
qmlVisualTouchDebugging()Description
TRUEnever evaluated
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
0-62
456 setFlag(QQuickItem::ItemHasContents);-
457 }
never executed: end of block
0
458 setAcceptTouchEvents(true);-
459#ifdef Q_OS_OSX-
460 setAcceptHoverEvents(true); // needed to enable touch events on mouse hover.-
461#endif-
462}
executed 62 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
62
463-
464QQuickMultiPointTouchArea::~QQuickMultiPointTouchArea()-
465{-
466 clearTouchLists();-
467 for (QObject *obj : qAsConst(_touchPoints)) {-
468 QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj);-
469 if (!dtp->isQmlDefined())
!dtp->isQmlDefined()Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-8
470 delete dtp;
never executed: delete dtp;
0
471 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
8
472}
executed 62 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
62
473-
474/*!-
475 \qmlproperty int QtQuick::MultiPointTouchArea::minimumTouchPoints-
476 \qmlproperty int QtQuick::MultiPointTouchArea::maximumTouchPoints-
477-
478 These properties hold the range of touch points to be handled by the touch area.-
479-
480 These are convenience that allow you to, for example, have nested MultiPointTouchAreas,-
481 one handling two finger touches, and another handling three finger touches.-
482-
483 By default, all touch points within the touch area are handled.-
484-
485 If mouseEnabled is true, the mouse acts as a touch point, so it is also-
486 subject to these constraints: for example if maximumTouchPoints is two, you-
487 can use the mouse as one touch point and a finger as another touch point-
488 for a total of two.-
489*/-
490-
491int QQuickMultiPointTouchArea::minimumTouchPoints() const-
492{-
493 return _minimumTouchPoints;
executed 2 times by 1 test: return _minimumTouchPoints;
Executed by:
  • tst_qquickmultipointtoucharea
2
494}-
495-
496void QQuickMultiPointTouchArea::setMinimumTouchPoints(int num)-
497{-
498 if (_minimumTouchPoints == num)
_minimumTouchPoints == numDescription
TRUEnever evaluated
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickmultipointtoucharea
0-30
499 return;
never executed: return;
0
500 _minimumTouchPoints = num;-
501 emit minimumTouchPointsChanged();-
502}
executed 30 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmultipointtoucharea
30
503-
504int QQuickMultiPointTouchArea::maximumTouchPoints() const-
505{-
506 return _maximumTouchPoints;
executed 2 times by 1 test: return _maximumTouchPoints;
Executed by:
  • tst_qquickmultipointtoucharea
2
507}-
508-
509void QQuickMultiPointTouchArea::setMaximumTouchPoints(int num)-
510{-
511 if (_maximumTouchPoints == num)
_maximumTouchPoints == numDescription
TRUEnever evaluated
FALSEevaluated 52 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickmultipointtoucharea
0-52
512 return;
never executed: return;
0
513 _maximumTouchPoints = num;-
514 emit maximumTouchPointsChanged();-
515}
executed 52 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmultipointtoucharea
52
516-
517/*!-
518 \qmlproperty bool QtQuick::MultiPointTouchArea::mouseEnabled-
519-
520 This property controls whether the MultiPointTouchArea will handle mouse-
521 events too. If it is true (the default), the touch area will treat the-
522 mouse the same as a single touch point; if it is false, the touch area will-
523 ignore mouse events and allow them to "pass through" so that they can be-
524 handled by other items underneath.-
525*/-
526void QQuickMultiPointTouchArea::setMouseEnabled(bool arg)-
527{-
528 if (_mouseEnabled != arg) {
_mouseEnabled != argDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-4
529 _mouseEnabled = arg;-
530 if (_mouseTouchPoint && !arg)
!argDescription
TRUEnever evaluated
FALSEnever evaluated
0
531 _mouseTouchPoint = nullptr;
never executed: _mouseTouchPoint = nullptr;
0
532 emit mouseEnabledChanged();-
533 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
4
534}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
4
535-
536void QQuickMultiPointTouchArea::touchEvent(QTouchEvent *event)-
537{-
538 switch (event->type()) {-
539 case QEvent::TouchBegin:
executed 66 times by 1 test: case QEvent::TouchBegin:
Executed by:
  • tst_qquickmultipointtoucharea
66
540 case QEvent::TouchUpdate:
executed 106 times by 2 tests: case QEvent::TouchUpdate:
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
106
541 case QEvent::TouchEnd: {
executed 32 times by 1 test: case QEvent::TouchEnd:
Executed by:
  • tst_qquickmultipointtoucharea
32
542 //if e.g. a parent Flickable has the mouse grab, don't process the touch events-
543 QQuickWindow *c = window();-
544 QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 204 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-204
545 if (grabber && grabber != this && grabber->keepMouseGrab() && grabber->isEnabled()) {
grabberDescription
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 142 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
grabber != thisDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
grabber->keepMouseGrab()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
grabber->isEnabled()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-142
546 QQuickItem *item = this;-
547 while ((item = item->parentItem())) {
(item = item->parentItem())Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
2-4
548 if (item == grabber)
item == grabberDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-4
549 return;
never executed: return;
0
550 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
4
551 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
2
552 updateTouchData(event);-
553 if (event->type() == QEvent::TouchEnd)
event->type() ...vent::TouchEndDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 172 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
32-172
554 ungrab();
executed 32 times by 1 test: ungrab();
Executed by:
  • tst_qquickmultipointtoucharea
32
555 break;
executed 204 times by 2 tests: break;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
204
556 }-
557 case QEvent::TouchCancel:
never executed: case QEvent::TouchCancel:
0
558 ungrab();-
559 break;
never executed: break;
0
560 default:
never executed: default:
0
561 QQuickItem::touchEvent(event);-
562 break;
never executed: break;
0
563 }-
564}-
565-
566void QQuickMultiPointTouchArea::grabGesture()-
567{-
568 _stealMouse = true;-
569-
570 grabMouse();-
571 setKeepMouseGrab(true);-
572-
573 QVector<int> ids;-
574 ids.reserve(_touchPoints.size());-
575 for (auto it = _touchPoints.keyBegin(), end = _touchPoints.keyEnd(); it != end; ++it) {
it != endDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
6-16
576 if (*it != -1) // -1 might be the mouse-point, but we already grabbed the mouse above.
*it != -1Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
2-14
577 ids.append(*it);
executed 14 times by 1 test: ids.append(*it);
Executed by:
  • tst_qquickmultipointtoucharea
14
578 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
16
579 grabTouchPoints(ids);-
580 setKeepTouchGrab(true);-
581}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
6
582-
583void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)-
584{-
585 bool ended = false;-
586 bool moved = false;-
587 bool started = false;-
588 bool isMouseEvent = false;-
589-
590 clearTouchLists();-
591 QList<QTouchEvent::TouchPoint> touchPoints;-
592-
593 switch (event->type()) {-
594 case QEvent::TouchBegin:
executed 78 times by 1 test: case QEvent::TouchBegin:
Executed by:
  • tst_qquickmultipointtoucharea
78
595 case QEvent::TouchUpdate:
executed 128 times by 2 tests: case QEvent::TouchUpdate:
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
128
596 case QEvent::TouchEnd:
executed 36 times by 1 test: case QEvent::TouchEnd:
Executed by:
  • tst_qquickmultipointtoucharea
36
597 touchPoints = static_cast<QTouchEvent*>(event)->touchPoints();-
598 break;
executed 242 times by 2 tests: break;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
242
599 case QEvent::MouseButtonPress:
executed 12 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquickmultipointtoucharea
12
600 case QEvent::MouseMove:
executed 34 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquickmultipointtoucharea
34
601 case QEvent::MouseButtonRelease: {
executed 10 times by 1 test: case QEvent::MouseButtonRelease:
Executed by:
  • tst_qquickmultipointtoucharea
10
602 QMouseEvent *me = static_cast<QMouseEvent*>(event);-
603 _mouseQpaTouchPoint.setPos(me->localPos());-
604 _mouseQpaTouchPoint.setScenePos(me->windowPos());-
605 _mouseQpaTouchPoint.setScreenPos(me->screenPos());-
606 if (event->type() == QEvent::MouseMove)
event->type() ...ent::MouseMoveDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
22-34
607 _mouseQpaTouchPoint.setState(Qt::TouchPointMoved);
executed 34 times by 1 test: _mouseQpaTouchPoint.setState(Qt::TouchPointMoved);
Executed by:
  • tst_qquickmultipointtoucharea
34
608 else if (event->type() == QEvent::MouseButtonRelease)
event->type() ...eButtonReleaseDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
10-12
609 _mouseQpaTouchPoint.setState(Qt::TouchPointReleased);
executed 10 times by 1 test: _mouseQpaTouchPoint.setState(Qt::TouchPointReleased);
Executed by:
  • tst_qquickmultipointtoucharea
10
610 else { // QEvent::MouseButtonPress-
611 addTouchPoint(me);-
612 started = true;-
613 _mouseQpaTouchPoint.setState(Qt::TouchPointPressed);-
614 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
12
615 touchPoints << _mouseQpaTouchPoint;-
616 isMouseEvent = true;-
617 break;
executed 56 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
56
618 }-
619 default:
never executed: default:
0
620 qWarning("updateTouchData: unhandled event type %d", event->type());-
621 break;
never executed: break;
0
622 }-
623-
624 if (!isMouseEvent && _mouseTouchPoint) {
!isMouseEventDescription
TRUEevaluated 242 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
56-242
625 QQuickWindow *c = window();-
626 if (c && c->mouseGrabberItem() == this)
cDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
c->mouseGrabberItem() == thisDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-28
627 touchPoints << _mouseQpaTouchPoint;
executed 28 times by 1 test: touchPoints << _mouseQpaTouchPoint;
Executed by:
  • tst_qquickmultipointtoucharea
28
628 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
28
629 int numTouchPoints = touchPoints.count();-
630 //always remove released touches, and make sure we handle all releases before adds.-
631 for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) {-
632 Qt::TouchPointState touchPointState = p.state();-
633 int id = p.id();-
634 if (touchPointState & Qt::TouchPointReleased) {
touchPointStat...hPointReleasedDescription
TRUEevaluated 96 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 494 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
96-494
635 QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id));-
636 if (!dtp)
!dtpDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 82 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
14-82
637 continue;
executed 14 times by 1 test: continue;
Executed by:
  • tst_qquickmultipointtoucharea
14
638 updateTouchPoint(dtp, &p);-
639 dtp->setPressed(false);-
640 _releasedTouchPoints.append(dtp);-
641 _touchPoints.remove(id);-
642 ended = true;-
643 }
executed 82 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
82
644 }
executed 576 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
576
645 if (numTouchPoints >= _minimumTouchPoints && numTouchPoints <= _maximumTouchPoints) {
numTouchPoints...mumTouchPointsDescription
TRUEevaluated 250 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
numTouchPoints...mumTouchPointsDescription
TRUEevaluated 240 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
10-250
646 for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) {-
647 Qt::TouchPointState touchPointState = p.state();-
648 int id = p.id();-
649 if (touchPointState & Qt::TouchPointReleased) {
touchPointStat...hPointReleasedDescription
TRUEevaluated 84 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 404 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
84-404
650 //handled above-
651 } else if (!_touchPoints.contains(id)) { //could be pressed, moved, or stationary
executed 84 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
!_touchPoints.contains(id)Description
TRUEevaluated 136 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 268 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
84-268
652 // (we may have just obtained enough points to start tracking them -- in that case moved or stationary count as newly pressed)-
653 addTouchPoint(&p);-
654 started = true;-
655 } else if (touchPointState & Qt::TouchPointMoved) {
executed 136 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
touchPointStat...ouchPointMovedDescription
TRUEevaluated 212 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
56-212
656 QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id));-
657 Q_ASSERT(dtp);-
658 _movedTouchPoints.append(dtp);-
659 updateTouchPoint(dtp,&p);-
660 moved = true;-
661 } else {
executed 212 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
212
662 QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id));-
663 Q_ASSERT(dtp);-
664 updateTouchPoint(dtp,&p);-
665 }
executed 56 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
56
666 }-
667-
668 //see if we should be grabbing the gesture-
669 if (!_stealMouse /* !ignoring gesture*/) {
!_stealMouseDescription
TRUEevaluated 218 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
22-218
670 bool offerGrab = false;-
671 const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();-
672 for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) {-
673 if (p.state() == Qt::TouchPointReleased)
p.state() == Q...hPointReleasedDescription
TRUEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 280 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
68-280
674 continue;
executed 68 times by 1 test: continue;
Executed by:
  • tst_qquickmultipointtoucharea
68
675 const QPointF &currentPos = p.scenePos();-
676 const QPointF &startPos = p.startScenePos();-
677 if (qAbs(currentPos.x() - startPos.x()) > dragThreshold)
qAbs(currentPo... dragThresholdDescription
TRUEevaluated 66 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 214 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
66-214
678 offerGrab = true;
executed 66 times by 2 tests: offerGrab = true;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
66
679 else if (qAbs(currentPos.y() - startPos.y()) > dragThreshold)
qAbs(currentPo... dragThresholdDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
16-198
680 offerGrab = true;
executed 16 times by 1 test: offerGrab = true;
Executed by:
  • tst_qquickmultipointtoucharea
16
681 if (offerGrab)
offerGrabDescription
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
82-198
682 break;
executed 82 times by 2 tests: break;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
82
683 }
executed 198 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
198
684-
685 if (offerGrab) {
offerGrabDescription
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 136 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
82-136
686 QQuickGrabGestureEvent event;-
687 event._touchPoints = _touchPoints.values();-
688 emit gestureStarted(&event);-
689 if (event.wantsGrab())
event.wantsGrab()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 76 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
6-76
690 grabGesture();
executed 6 times by 1 test: grabGesture();
Executed by:
  • tst_qquickmultipointtoucharea
6
691 }
executed 82 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
82
692 }
executed 218 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
218
693-
694 if (ended)
endedDescription
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 190 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
50-190
695 emit released(_releasedTouchPoints);
executed 50 times by 2 tests: released(_releasedTouchPoints);
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
50
696 if (moved)
movedDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 142 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
98-142
697 emit updated(_movedTouchPoints);
executed 98 times by 2 tests: updated(_movedTouchPoints);
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
98
698 if (started)
startedDescription
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 138 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
102-138
699 emit pressed(_pressedTouchPoints);
executed 102 times by 2 tests: pressed(_pressedTouchPoints);
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
102
700 if (ended || moved || started) emit touchUpdated(_touchPoints.values());
executed 232 times by 2 tests: touchUpdated(_touchPoints.values());
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
endedDescription
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 190 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
movedDescription
TRUEevaluated 90 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
startedDescription
TRUEevaluated 92 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
8-232
701 }
executed 240 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
240
702}
executed 298 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
298
703-
704void QQuickMultiPointTouchArea::clearTouchLists()-
705{-
706 for (QObject *obj : qAsConst(_releasedTouchPoints)) {-
707 QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj);-
708 if (!dtp->isQmlDefined()) {
!dtp->isQmlDefined()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 54 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
20-54
709 _touchPoints.remove(dtp->pointId());-
710 delete dtp;-
711 } else {
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
20
712 dtp->setInUse(false);-
713 }
executed 54 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
54
714 }-
715 _releasedTouchPoints.clear();-
716 _pressedTouchPoints.clear();-
717 _movedTouchPoints.clear();-
718}
executed 396 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
396
719-
720void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p)-
721{-
722 QQuickTouchPoint *dtp = nullptr;-
723 for (QQuickTouchPoint* tp : qAsConst(_touchPrototypes)) {-
724 if (!tp->inUse()) {
!tp->inUse()Description
TRUEevaluated 90 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 78 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
78-90
725 tp->setInUse(true);-
726 dtp = tp;-
727 break;
executed 90 times by 2 tests: break;
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
90
728 }-
729 }
executed 78 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
78
730-
731 if (dtp == nullptr)
dtp == nullptrDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 90 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
46-90
732 dtp = new QQuickTouchPoint(false);
executed 46 times by 1 test: dtp = new QQuickTouchPoint(false);
Executed by:
  • tst_qquickmultipointtoucharea
46
733 dtp->setPointId(p->id());-
734 updateTouchPoint(dtp,p);-
735 dtp->setPressed(true);-
736 _touchPoints.insert(p->id(),dtp);-
737 _pressedTouchPoints.append(dtp);-
738}
executed 136 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
136
739-
740void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e)-
741{-
742 QQuickTouchPoint *dtp = nullptr;-
743 for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes))-
744 if (!tp->inUse()) {
!tp->inUse()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
4-8
745 tp->setInUse(true);-
746 dtp = tp;-
747 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
8
748 }-
749-
750 if (dtp == nullptr)
dtp == nullptrDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
4-8
751 dtp = new QQuickTouchPoint(false);
executed 4 times by 1 test: dtp = new QQuickTouchPoint(false);
Executed by:
  • tst_qquickmultipointtoucharea
4
752 updateTouchPoint(dtp, e);-
753 dtp->setPressed(true);-
754 _touchPoints.insert(-1, dtp);-
755 _pressedTouchPoints.append(dtp);-
756 _mouseTouchPoint = dtp;-
757}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
12
758-
759#ifdef Q_OS_OSX-
760void QQuickMultiPointTouchArea::hoverEnterEvent(QHoverEvent *event)-
761{-
762 Q_UNUSED(event);-
763 setTouchEventsEnabled(true);-
764}-
765-
766void QQuickMultiPointTouchArea::hoverLeaveEvent(QHoverEvent *event)-
767{-
768 Q_UNUSED(event);-
769 setTouchEventsEnabled(false);-
770}-
771-
772void QQuickMultiPointTouchArea::setTouchEventsEnabled(bool enable)-
773{-
774 // Resolve function for enabling touch events from the (cocoa) platform plugin.-
775 typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);-
776 RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(-
777 QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));-
778 if (!registerTouchWindow)-
779 return; // Not necessarily an error, Qt might be using a different platform plugin.-
780-
781 registerTouchWindow(window(), enable);-
782}-
783#endif // Q_OS_OSX-
784-
785void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype)-
786{-
787 int id = _touchPrototypes.count();-
788 prototype->setPointId(id);-
789 _touchPrototypes.insert(id, prototype);-
790}
executed 120 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
120
791-
792void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QTouchEvent::TouchPoint *p)-
793{-
794 //TODO: if !qmlDefined, could bypass setters.-
795 // also, should only emit signals after all values have been set-
796 dtp->setUniqueId(p->uniqueId());-
797 dtp->setX(p->pos().x());-
798 dtp->setY(p->pos().y());-
799 dtp->setEllipseDiameters(p->ellipseDiameters());-
800 dtp->setPressure(p->pressure());-
801 dtp->setRotation(p->rotation());-
802 dtp->setVelocity(p->velocity());-
803 dtp->setArea(p->rect());-
804 dtp->setStartX(p->startPos().x());-
805 dtp->setStartY(p->startPos().y());-
806 dtp->setPreviousX(p->lastPos().x());-
807 dtp->setPreviousY(p->lastPos().y());-
808 dtp->setSceneX(p->scenePos().x());-
809 dtp->setSceneY(p->scenePos().y());-
810}
executed 486 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
486
811-
812void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QMouseEvent *e)-
813{-
814 dtp->setPreviousX(dtp->x());-
815 dtp->setPreviousY(dtp->y());-
816 dtp->setX(e->localPos().x());-
817 dtp->setY(e->localPos().y());-
818 if (e->type() == QEvent::MouseButtonPress) {
e->type() == Q...useButtonPressDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-12
819 dtp->setStartX(e->localPos().x());-
820 dtp->setStartY(e->localPos().y());-
821 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
12
822 dtp->setSceneX(e->windowPos().x());-
823 dtp->setSceneY(e->windowPos().y());-
824}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
12
825-
826void QQuickMultiPointTouchArea::mousePressEvent(QMouseEvent *event)-
827{-
828 if (!isEnabled() || !_mouseEnabled || event->button() != Qt::LeftButton) {
!isEnabled()Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!_mouseEnabledDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
event->button(...Qt::LeftButtonDescription
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-44
829 QQuickItem::mousePressEvent(event);-
830 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickmultipointtoucharea
4
831 }-
832-
833 _stealMouse = false;-
834 setKeepMouseGrab(false);-
835 event->setAccepted(true);-
836 _mousePos = event->localPos();-
837-
838 if (event->source() != Qt::MouseEventNotSynthesized)
event->source(...NotSynthesizedDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
16-24
839 return;
executed 24 times by 1 test: return;
Executed by:
  • tst_qquickmultipointtoucharea
24
840-
841 if (_touchPoints.count() >= _minimumTouchPoints - 1 && _touchPoints.count() < _maximumTouchPoints) {
_touchPoints.c...ouchPoints - 1Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
_touchPoints.c...mumTouchPointsDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-16
842 updateTouchData(event);-
843 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
12
844}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
16
845-
846void QQuickMultiPointTouchArea::mouseMoveEvent(QMouseEvent *event)-
847{-
848 if (!isEnabled() || !_mouseEnabled) {
!isEnabled()Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!_mouseEnabledDescription
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-42
849 QQuickItem::mouseMoveEvent(event);-
850 return;
never executed: return;
0
851 }-
852-
853 if (event->source() != Qt::MouseEventNotSynthesized)
event->source(...NotSynthesizedDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
8-34
854 return;
executed 8 times by 1 test: return;
Executed by:
  • tst_qquickmultipointtoucharea
8
855-
856 _movedTouchPoints.clear();-
857 updateTouchData(event);-
858}
executed 34 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
34
859-
860void QQuickMultiPointTouchArea::mouseReleaseEvent(QMouseEvent *event)-
861{-
862 _stealMouse = false;-
863 if (!isEnabled() || !_mouseEnabled) {
!isEnabled()Description
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!_mouseEnabledDescription
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-22
864 QQuickItem::mouseReleaseEvent(event);-
865 return;
never executed: return;
0
866 }-
867-
868 if (event->source() != Qt::MouseEventNotSynthesized)
event->source(...NotSynthesizedDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
6-16
869 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquickmultipointtoucharea
6
870-
871 if (_mouseTouchPoint) {
_mouseTouchPointDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
6-10
872 updateTouchData(event);-
873 _mouseTouchPoint->setInUse(false);-
874 _releasedTouchPoints.removeAll(_mouseTouchPoint);-
875 _mouseTouchPoint = nullptr;-
876 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
10
877-
878 QQuickWindow *c = window();-
879 if (c && c->mouseGrabberItem() == this)
cDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
c->mouseGrabberItem() == thisDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-16
880 ungrabMouse();
executed 16 times by 1 test: ungrabMouse();
Executed by:
  • tst_qquickmultipointtoucharea
16
881 setKeepMouseGrab(false);-
882}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
16
883-
884void QQuickMultiPointTouchArea::ungrab()-
885{-
886 _stealMouse = false;-
887 setKeepMouseGrab(false);-
888 setKeepTouchGrab(false);-
889 ungrabTouchPoints();-
890-
891 if (_touchPoints.count()) {
_touchPoints.count()Description
TRUEevaluated 36 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
FALSEevaluated 96 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
36-96
892 for (QObject *obj : qAsConst(_touchPoints))-
893 static_cast<QQuickTouchPoint*>(obj)->setPressed(false);
executed 58 times by 2 tests: static_cast<QQuickTouchPoint*>(obj)->setPressed(false);
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
58
894 emit canceled(_touchPoints.values());-
895 clearTouchLists();-
896 for (QObject *obj : qAsConst(_touchPoints)) {-
897 QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj);-
898 if (!dtp->isQmlDefined())
!dtp->isQmlDefined()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
28-30
899 delete dtp;
executed 28 times by 1 test: delete dtp;
Executed by:
  • tst_qquickmultipointtoucharea
28
900 else-
901 dtp->setInUse(false);
executed 30 times by 2 tests: dtp->setInUse(false);
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
30
902 }-
903 _touchPoints.clear();-
904 emit touchUpdated(QList<QObject*>());-
905 }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
36
906}
executed 132 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
132
907-
908void QQuickMultiPointTouchArea::mouseUngrabEvent()-
909{-
910 ungrab();-
911}
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
26
912-
913void QQuickMultiPointTouchArea::touchUngrabEvent()-
914{-
915 ungrab();-
916}
executed 66 times by 2 tests: end of block
Executed by:
  • tst_multipointtoucharea_interop
  • tst_qquickmultipointtoucharea
66
917-
918bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event)-
919{-
920 QPointF localPos = mapFromScene(event->windowPos());-
921-
922 QQuickWindow *c = window();-
923 QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-42
924 bool stealThisEvent = _stealMouse;-
925 if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) {
stealThisEventDescription
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
contains(localPos)Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
!grabberDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!grabber->keepMouseGrab()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-42
926 QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(),-
927 event->button(), event->buttons(), event->modifiers());-
928 mouseEvent.setAccepted(false);-
929 QGuiApplicationPrivate::setMouseEventCapsAndVelocity(&mouseEvent,-
930 QGuiApplicationPrivate::mouseEventCaps(event),-
931 QGuiApplicationPrivate::mouseEventVelocity(event));-
932 QGuiApplicationPrivate::setMouseEventSource(&mouseEvent, Qt::MouseEventSynthesizedByQt);-
933-
934 switch (mouseEvent.type()) {-
935 case QEvent::MouseMove:
executed 8 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquickmultipointtoucharea
8
936 mouseMoveEvent(&mouseEvent);-
937 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
8
938 case QEvent::MouseButtonPress:
executed 24 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquickmultipointtoucharea
24
939 mousePressEvent(&mouseEvent);-
940 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
24
941 case QEvent::MouseButtonRelease:
executed 6 times by 1 test: case QEvent::MouseButtonRelease:
Executed by:
  • tst_qquickmultipointtoucharea
6
942 mouseReleaseEvent(&mouseEvent);-
943 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
6
944 default:
never executed: default:
0
945 break;
never executed: break;
0
946 }-
947 grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-38
948 if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this)
grabberDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
stealThisEventDescription
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!grabber->keepMouseGrab()Description
TRUEnever evaluated
FALSEnever evaluated
grabber != thisDescription
TRUEnever evaluated
FALSEnever evaluated
0-24
949 grabMouse();
never executed: grabMouse();
0
950-
951 return stealThisEvent;
executed 38 times by 1 test: return stealThisEvent;
Executed by:
  • tst_qquickmultipointtoucharea
38
952 }-
953 if (event->type() == QEvent::MouseButtonRelease) {
event->type() ...eButtonReleaseDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
2
954 _stealMouse = false;-
955 if (c && c->mouseGrabberItem() == this)
cDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
c->mouseGrabberItem() == thisDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-2
956 ungrabMouse();
never executed: ungrabMouse();
0
957 setKeepMouseGrab(false);-
958 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmultipointtoucharea
2
959 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_qquickmultipointtoucharea
4
960}-
961-
962bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEvent *event)-
963{-
964 if (!isEnabled() || !isVisible())
!isEnabled()Description
TRUEnever evaluated
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!isVisible()Description
TRUEnever evaluated
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-84
965 return QQuickItem::childMouseEventFilter(receiver, event);
never executed: return QQuickItem::childMouseEventFilter(receiver, event);
0
966 switch (event->type()) {-
967 case QEvent::MouseButtonPress:
executed 24 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquickmultipointtoucharea
24
968 case QEvent::MouseMove:
executed 10 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquickmultipointtoucharea
10
969 case QEvent::MouseButtonRelease:
executed 8 times by 1 test: case QEvent::MouseButtonRelease:
Executed by:
  • tst_qquickmultipointtoucharea
8
970 return sendMouseEvent(static_cast<QMouseEvent *>(event));
executed 42 times by 1 test: return sendMouseEvent(static_cast<QMouseEvent *>(event));
Executed by:
  • tst_qquickmultipointtoucharea
42
971 break;
dead code: break;
-
972 case QEvent::TouchBegin:
executed 12 times by 1 test: case QEvent::TouchBegin:
Executed by:
  • tst_qquickmultipointtoucharea
12
973 case QEvent::TouchUpdate:
executed 24 times by 1 test: case QEvent::TouchUpdate:
Executed by:
  • tst_qquickmultipointtoucharea
24
974 if (!shouldFilter(event))
!shouldFilter(event)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
2-34
975 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_qquickmultipointtoucharea
2
976 updateTouchData(event);-
977 return _stealMouse;
executed 34 times by 1 test: return _stealMouse;
Executed by:
  • tst_qquickmultipointtoucharea
34
978 case QEvent::TouchEnd: {
executed 6 times by 1 test: case QEvent::TouchEnd:
Executed by:
  • tst_qquickmultipointtoucharea
6
979 if (!shouldFilter(event))
!shouldFilter(event)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
2-4
980 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_qquickmultipointtoucharea
2
981 updateTouchData(event);-
982 ungrab();-
983 }-
984 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
4
985 default:
never executed: default:
0
986 break;
never executed: break;
0
987 }-
988 return QQuickItem::childMouseEventFilter(receiver, event);
executed 4 times by 1 test: return QQuickItem::childMouseEventFilter(receiver, event);
Executed by:
  • tst_qquickmultipointtoucharea
4
989}-
990-
991bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event)-
992{-
993 QQuickWindow *c = window();-
994 QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-42
995 bool disabledItem = grabber && !grabber->isEnabled();
grabberDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!grabber->isEnabled()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-22
996 bool stealThisEvent = _stealMouse;-
997 bool containsPoint = false;-
998 if (!stealThisEvent) {
!stealThisEventDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-42
999 switch (event->type()) {-
1000 case QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
1001 case QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
1002 case QEvent::MouseButtonRelease: {
never executed: case QEvent::MouseButtonRelease:
0
1003 QMouseEvent *me = static_cast<QMouseEvent*>(event);-
1004 containsPoint = contains(mapFromScene(me->windowPos()));-
1005 }-
1006 break;
never executed: break;
0
1007 case QEvent::TouchBegin:
executed 12 times by 1 test: case QEvent::TouchBegin:
Executed by:
  • tst_qquickmultipointtoucharea
12
1008 case QEvent::TouchUpdate:
executed 24 times by 1 test: case QEvent::TouchUpdate:
Executed by:
  • tst_qquickmultipointtoucharea
24
1009 case QEvent::TouchEnd: {
executed 6 times by 1 test: case QEvent::TouchEnd:
Executed by:
  • tst_qquickmultipointtoucharea
6
1010 QTouchEvent *te = static_cast<QTouchEvent*>(event);-
1011 for (const QTouchEvent::TouchPoint &point : te->touchPoints()) {-
1012 if (contains(mapFromScene(point.scenePos()))) {
contains(mapFr...t.scenePos()))Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-42
1013 containsPoint = true;-
1014 break;
executed 42 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
42
1015 }-
1016 }
never executed: end of block
0
1017 }-
1018 break;
executed 42 times by 1 test: break;
Executed by:
  • tst_qquickmultipointtoucharea
42
1019 default:
never executed: default:
0
1020 break;
never executed: break;
0
1021 }-
1022 }-
1023 if ((stealThisEvent || containsPoint) && (!grabber || !grabber->keepMouseGrab() || disabledItem)) {
stealThisEventDescription
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
containsPointDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
!grabberDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
!grabber->keepMouseGrab()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
disabledItemDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmultipointtoucharea
0-42
1024 return true;
executed 38 times by 1 test: return true;
Executed by:
  • tst_qquickmultipointtoucharea
38
1025 }-
1026 ungrab();-
1027 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_qquickmultipointtoucharea
4
1028}-
1029-
1030QSGNode *QQuickMultiPointTouchArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)-
1031{-
1032 Q_UNUSED(data);-
1033-
1034 if (!qmlVisualTouchDebugging())
!qmlVisualTouchDebugging()Description
TRUEnever evaluated
FALSEnever evaluated
0
1035 return nullptr;
never executed: return nullptr;
0
1036-
1037 QSGInternalRectangleNode *rectangle = static_cast<QSGInternalRectangleNode *>(oldNode);-
1038 if (!rectangle) rectangle = QQuickItemPrivate::get(this)->sceneGraphContext()->createInternalRectangleNode();
never executed: rectangle = QQuickItemPrivate::get(this)->sceneGraphContext()->createInternalRectangleNode();
!rectangleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1039-
1040 rectangle->setRect(QRectF(0, 0, width(), height()));-
1041 rectangle->setColor(QColor(255, 0, 0, 50));-
1042 rectangle->update();-
1043 return rectangle;
never executed: return rectangle;
0
1044}-
1045-
1046QT_END_NAMESPACE-
1047-
1048#include "moc_qquickmultipointtoucharea_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0