Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/handlers/qquickhandlerpoint.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | extern const QLoggingCategory &DBG_TOUCH_TARGET(); | - | ||||||
4 | QQuickHandlerPoint::QQuickHandlerPoint() | - | ||||||
5 | : m_id(0) | - | ||||||
6 | , m_rotation(0) | - | ||||||
7 | , m_pressure(0) | - | ||||||
8 | {} executed 3062 times by 5 tests: end of block Executed by:
| 3062 | ||||||
9 | - | |||||||
10 | void QQuickHandlerPoint::reset() | - | ||||||
11 | { | - | ||||||
12 | m_id = 0; | - | ||||||
13 | m_uniqueId = QPointingDeviceUniqueId(); | - | ||||||
14 | m_position = QPointF(); | - | ||||||
15 | m_scenePosition = QPointF(); | - | ||||||
16 | m_pressPosition = QPointF(); | - | ||||||
17 | m_scenePressPosition = QPointF(); | - | ||||||
18 | m_sceneGrabPosition = QPointF(); | - | ||||||
19 | m_velocity = QVector2D(); | - | ||||||
20 | m_rotation = 0; | - | ||||||
21 | m_pressure = 0; | - | ||||||
22 | m_ellipseDiameters = QSizeF(); | - | ||||||
23 | m_pressedButtons = Qt::NoButton; | - | ||||||
24 | m_pressedModifiers = Qt::NoModifier; | - | ||||||
25 | } executed 548 times by 4 tests: end of block Executed by:
| 548 | ||||||
26 | - | |||||||
27 | void QQuickHandlerPoint::reset(const QQuickEventPoint *point) | - | ||||||
28 | { | - | ||||||
29 | m_id = point->pointId(); | - | ||||||
30 | const QQuickPointerEvent *event = point->pointerEvent(); | - | ||||||
31 | switch (point->state()) { | - | ||||||
32 | case executed 234 times by 4 tests: QQuickEventPoint::Pressed:case QQuickEventPoint::Pressed: Executed by:
executed 234 times by 4 tests: case QQuickEventPoint::Pressed: Executed by:
| 234 | ||||||
33 | m_pressPosition = point->position(); | - | ||||||
34 | m_scenePressPosition = point->scenePosition(); | - | ||||||
35 | m_pressedButtons = event->buttons(); | - | ||||||
36 | break; executed 234 times by 4 tests: break; Executed by:
| 234 | ||||||
37 | case executed 200 times by 4 tests: QQuickEventPoint::Released:case QQuickEventPoint::Released: Executed by:
executed 200 times by 4 tests: case QQuickEventPoint::Released: Executed by:
| 200 | ||||||
38 | reset(); | - | ||||||
39 | return; executed 200 times by 4 tests: return; Executed by:
| 200 | ||||||
40 | default executed 1278 times by 4 tests: :default: Executed by:
executed 1278 times by 4 tests: default: Executed by:
| 1278 | ||||||
41 | m_pressedButtons = event->buttons(); | - | ||||||
42 | break; executed 1278 times by 4 tests: break; Executed by:
| 1278 | ||||||
43 | } | - | ||||||
44 | m_pressedModifiers = event->modifiers(); | - | ||||||
45 | if (event->asPointerTouchEvent()
| 192-1320 | ||||||
46 | const QQuickEventTouchPoint *tp = static_cast<const QQuickEventTouchPoint *>(point); | - | ||||||
47 | m_uniqueId = tp->uniqueId(); | - | ||||||
48 | m_rotation = tp->rotation(); | - | ||||||
49 | m_pressure = tp->pressure(); | - | ||||||
50 | m_ellipseDiameters = tp->ellipseDiameters(); | - | ||||||
51 | } executed 1320 times by 4 tests: else if (event->asPointerTabletEvent()end of block Executed by:
| 0-1320 | ||||||
52 | - | |||||||
53 | } never executed: else {end of block | 0 | ||||||
54 | m_uniqueId = event->device()->uniqueId(); | - | ||||||
55 | m_rotation = 0; | - | ||||||
56 | m_pressure = event->buttons()
| 0-192 | ||||||
57 | m_ellipseDiameters = QSizeF(); | - | ||||||
58 | } executed 192 times by 3 tests: end of block Executed by:
| 192 | ||||||
59 | m_position = point->position(); | - | ||||||
60 | m_scenePosition = point->scenePosition(); | - | ||||||
61 | if (point->state() == QQuickEventPoint::Updated
| 246-1266 | ||||||
62 | m_velocity = point->velocity(); executed 1266 times by 4 tests: m_velocity = point->velocity(); Executed by:
| 1266 | ||||||
63 | } executed 1512 times by 4 tests: end of block Executed by:
| 1512 | ||||||
64 | - | |||||||
65 | void QQuickHandlerPoint::reset(const QVector<QQuickEventPoint *> &points) | - | ||||||
66 | { | - | ||||||
67 | if (points.isEmpty()
| 0-31 | ||||||
68 | QMessageLogger(__FILE__, 139, __PRETTY_FUNCTION__).warning("reset: no points"); | - | ||||||
69 | return; never executed: return; | 0 | ||||||
70 | } | - | ||||||
71 | if (points.count() == 1
| 0-31 | ||||||
72 | reset(points.first()); | - | ||||||
73 | return; never executed: return; | 0 | ||||||
74 | } | - | ||||||
75 | - | |||||||
76 | const QQuickPointerEvent *event = points.first()->pointerEvent(); | - | ||||||
77 | QPointF posSum; | - | ||||||
78 | QPointF scenePosSum; | - | ||||||
79 | QVector2D velocitySum; | - | ||||||
80 | qreal pressureSum = 0; | - | ||||||
81 | QSizeF ellipseDiameterSum; | - | ||||||
82 | bool press = false; | - | ||||||
83 | const QQuickPointerTouchEvent *touchEvent = event->asPointerTouchEvent(); | - | ||||||
84 | for (const QQuickEventPoint *point : qAsConst(points)) { | - | ||||||
85 | posSum += point->position(); | - | ||||||
86 | scenePosSum += point->scenePosition(); | - | ||||||
87 | velocitySum += point->velocity(); | - | ||||||
88 | if (touchEvent
| 0-93 | ||||||
89 | pressureSum += static_cast<const QQuickEventTouchPoint *>(point)->pressure(); | - | ||||||
90 | ellipseDiameterSum += static_cast<const QQuickEventTouchPoint *>(point)->ellipseDiameters(); | - | ||||||
91 | } executed 93 times by 1 test: end of block Executed by:
| 93 | ||||||
92 | if (point->state() == QQuickEventPoint::Pressed
| 2-91 | ||||||
93 | press = true; executed 2 times by 1 test: press = true; Executed by:
| 2 | ||||||
94 | } executed 93 times by 1 test: end of block Executed by:
| 93 | ||||||
95 | m_id = 0; | - | ||||||
96 | m_uniqueId = QPointingDeviceUniqueId(); | - | ||||||
97 | m_pressedButtons = event->buttons(); | - | ||||||
98 | m_pressedModifiers = event->modifiers(); | - | ||||||
99 | m_position = posSum / points.size(); | - | ||||||
100 | m_scenePosition = scenePosSum / points.size(); | - | ||||||
101 | if (press
| 2-29 | ||||||
102 | m_pressPosition = m_position; | - | ||||||
103 | m_scenePressPosition = m_scenePosition; | - | ||||||
104 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||
105 | m_velocity = velocitySum / points.size(); | - | ||||||
106 | m_rotation = 0; | - | ||||||
107 | m_pressure = pressureSum / points.size(); | - | ||||||
108 | m_ellipseDiameters = ellipseDiameterSum / points.size(); | - | ||||||
109 | } executed 31 times by 1 test: end of block Executed by:
| 31 | ||||||
110 | - | |||||||
Switch to Source code | Preprocessed file |