| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickmultipointtoucharea.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | static bool qmlVisualTouchDebugging() { static enum { Yes, No, Unknown } status = Unknown; if (status == Unknown
never executed: }status = Yes;never executed: }end of blockexecuted 8 times by 4 tests: returnend of blockExecuted by:
executed 62 times by 4 tests: status == Yes;return status == Yes;Executed by:
executed 62 times by 4 tests: }return status == Yes;Executed by:
| 0-62 | ||||||||||||||||||||||||||||||
| 5 | void QQuickTouchPoint::setPointId(int id) | - | ||||||||||||||||||||||||||||||
| 6 | { | - | ||||||||||||||||||||||||||||||
| 7 | if (_id == id
| 70-186 | ||||||||||||||||||||||||||||||
| 8 | return; executed 70 times by 3 tests: return;Executed by:
| 70 | ||||||||||||||||||||||||||||||
| 9 | _id = id; | - | ||||||||||||||||||||||||||||||
| 10 | pointIdChanged(); | - | ||||||||||||||||||||||||||||||
| 11 | } executed 186 times by 3 tests: end of blockExecuted by:
| 186 | ||||||||||||||||||||||||||||||
| 12 | void QQuickTouchPoint::setX(qreal x) | - | ||||||||||||||||||||||||||||||
| 13 | { | - | ||||||||||||||||||||||||||||||
| 14 | if (_x == x
| 214-284 | ||||||||||||||||||||||||||||||
| 15 | return; executed 214 times by 2 tests: return;Executed by:
| 214 | ||||||||||||||||||||||||||||||
| 16 | _x = x; | - | ||||||||||||||||||||||||||||||
| 17 | xChanged(); | - | ||||||||||||||||||||||||||||||
| 18 | } executed 284 times by 2 tests: end of blockExecuted by:
| 284 | ||||||||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||||||||
| 20 | void QQuickTouchPoint::setY(qreal y) | - | ||||||||||||||||||||||||||||||
| 21 | { | - | ||||||||||||||||||||||||||||||
| 22 | if (_y == y
| 244-254 | ||||||||||||||||||||||||||||||
| 23 | return; executed 244 times by 2 tests: return;Executed by:
| 244 | ||||||||||||||||||||||||||||||
| 24 | _y = y; | - | ||||||||||||||||||||||||||||||
| 25 | yChanged(); | - | ||||||||||||||||||||||||||||||
| 26 | } executed 254 times by 2 tests: end of blockExecuted by:
| 254 | ||||||||||||||||||||||||||||||
| 27 | void QQuickTouchPoint::setEllipseDiameters(const QSizeF &d) | - | ||||||||||||||||||||||||||||||
| 28 | { | - | ||||||||||||||||||||||||||||||
| 29 | if (_ellipseDiameters == d
| 106-380 | ||||||||||||||||||||||||||||||
| 30 | return; executed 380 times by 2 tests: return;Executed by:
| 380 | ||||||||||||||||||||||||||||||
| 31 | _ellipseDiameters = d; | - | ||||||||||||||||||||||||||||||
| 32 | ellipseDiametersChanged(); | - | ||||||||||||||||||||||||||||||
| 33 | } executed 106 times by 2 tests: end of blockExecuted by:
| 106 | ||||||||||||||||||||||||||||||
| 34 | void QQuickTouchPoint::setPressure(qreal pressure) | - | ||||||||||||||||||||||||||||||
| 35 | { | - | ||||||||||||||||||||||||||||||
| 36 | if (_pressure == pressure
| 200-286 | ||||||||||||||||||||||||||||||
| 37 | return; executed 286 times by 2 tests: return;Executed by:
| 286 | ||||||||||||||||||||||||||||||
| 38 | _pressure = pressure; | - | ||||||||||||||||||||||||||||||
| 39 | pressureChanged(); | - | ||||||||||||||||||||||||||||||
| 40 | } executed 200 times by 2 tests: end of blockExecuted by:
| 200 | ||||||||||||||||||||||||||||||
| 41 | void QQuickTouchPoint::setRotation(qreal r) | - | ||||||||||||||||||||||||||||||
| 42 | { | - | ||||||||||||||||||||||||||||||
| 43 | if (_rotation == r
| 0-486 | ||||||||||||||||||||||||||||||
| 44 | return; executed 486 times by 2 tests: return;Executed by:
| 486 | ||||||||||||||||||||||||||||||
| 45 | _rotation = r; | - | ||||||||||||||||||||||||||||||
| 46 | rotationChanged(); | - | ||||||||||||||||||||||||||||||
| 47 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||||||||
| 49 | void QQuickTouchPoint::setVelocity(const QVector2D &velocity) | - | ||||||||||||||||||||||||||||||
| 50 | { | - | ||||||||||||||||||||||||||||||
| 51 | if (_velocity == velocity
| 0-486 | ||||||||||||||||||||||||||||||
| 52 | return; executed 486 times by 2 tests: return;Executed by:
| 486 | ||||||||||||||||||||||||||||||
| 53 | _velocity = velocity; | - | ||||||||||||||||||||||||||||||
| 54 | velocityChanged(); | - | ||||||||||||||||||||||||||||||
| 55 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 56 | void QQuickTouchPoint::setArea(const QRectF &area) | - | ||||||||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||||||||
| 58 | if (_area == area
| 166-320 | ||||||||||||||||||||||||||||||
| 59 | return; executed 166 times by 2 tests: return;Executed by:
| 166 | ||||||||||||||||||||||||||||||
| 60 | _area = area; | - | ||||||||||||||||||||||||||||||
| 61 | areaChanged(); | - | ||||||||||||||||||||||||||||||
| 62 | } executed 320 times by 2 tests: end of blockExecuted by:
| 320 | ||||||||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||||||||
| 69 | void QQuickTouchPoint::setPressed(bool pressed) | - | ||||||||||||||||||||||||||||||
| 70 | { | - | ||||||||||||||||||||||||||||||
| 71 | if (_pressed == pressed
| 0-288 | ||||||||||||||||||||||||||||||
| 72 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 73 | _pressed = pressed; | - | ||||||||||||||||||||||||||||||
| 74 | pressedChanged(); | - | ||||||||||||||||||||||||||||||
| 75 | } executed 288 times by 2 tests: end of blockExecuted by:
| 288 | ||||||||||||||||||||||||||||||
| 76 | void QQuickTouchPoint::setStartX(qreal startX) | - | ||||||||||||||||||||||||||||||
| 77 | { | - | ||||||||||||||||||||||||||||||
| 78 | if (_startX == startX
| 144-354 | ||||||||||||||||||||||||||||||
| 79 | return; executed 354 times by 2 tests: return;Executed by:
| 354 | ||||||||||||||||||||||||||||||
| 80 | _startX = startX; | - | ||||||||||||||||||||||||||||||
| 81 | startXChanged(); | - | ||||||||||||||||||||||||||||||
| 82 | } executed 144 times by 2 tests: end of blockExecuted by:
| 144 | ||||||||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||||||||
| 84 | void QQuickTouchPoint::setStartY(qreal startY) | - | ||||||||||||||||||||||||||||||
| 85 | { | - | ||||||||||||||||||||||||||||||
| 86 | if (_startY == startY
| 138-360 | ||||||||||||||||||||||||||||||
| 87 | return; executed 360 times by 2 tests: return;Executed by:
| 360 | ||||||||||||||||||||||||||||||
| 88 | _startY = startY; | - | ||||||||||||||||||||||||||||||
| 89 | startYChanged(); | - | ||||||||||||||||||||||||||||||
| 90 | } executed 138 times by 2 tests: end of blockExecuted by:
| 138 | ||||||||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||||||||
| 98 | void QQuickTouchPoint::setPreviousX(qreal previousX) | - | ||||||||||||||||||||||||||||||
| 99 | { | - | ||||||||||||||||||||||||||||||
| 100 | if (_previousX == previousX
| 248-250 | ||||||||||||||||||||||||||||||
| 101 | return; executed 250 times by 2 tests: return;Executed by:
| 250 | ||||||||||||||||||||||||||||||
| 102 | _previousX = previousX; | - | ||||||||||||||||||||||||||||||
| 103 | previousXChanged(); | - | ||||||||||||||||||||||||||||||
| 104 | } executed 248 times by 2 tests: end of blockExecuted by:
| 248 | ||||||||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||||||||
| 106 | void QQuickTouchPoint::setPreviousY(qreal previousY) | - | ||||||||||||||||||||||||||||||
| 107 | { | - | ||||||||||||||||||||||||||||||
| 108 | if (_previousY == previousY
| 220-278 | ||||||||||||||||||||||||||||||
| 109 | return; executed 278 times by 2 tests: return;Executed by:
| 278 | ||||||||||||||||||||||||||||||
| 110 | _previousY = previousY; | - | ||||||||||||||||||||||||||||||
| 111 | previousYChanged(); | - | ||||||||||||||||||||||||||||||
| 112 | } executed 220 times by 2 tests: end of blockExecuted by:
| 220 | ||||||||||||||||||||||||||||||
| 113 | void QQuickTouchPoint::setSceneX(qreal sceneX) | - | ||||||||||||||||||||||||||||||
| 114 | { | - | ||||||||||||||||||||||||||||||
| 115 | if (_sceneX == sceneX
| 214-284 | ||||||||||||||||||||||||||||||
| 116 | return; executed 214 times by 2 tests: return;Executed by:
| 214 | ||||||||||||||||||||||||||||||
| 117 | _sceneX = sceneX; | - | ||||||||||||||||||||||||||||||
| 118 | sceneXChanged(); | - | ||||||||||||||||||||||||||||||
| 119 | } executed 284 times by 2 tests: end of blockExecuted by:
| 284 | ||||||||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||||||||
| 121 | void QQuickTouchPoint::setSceneY(qreal sceneY) | - | ||||||||||||||||||||||||||||||
| 122 | { | - | ||||||||||||||||||||||||||||||
| 123 | if (_sceneY == sceneY
| 244-254 | ||||||||||||||||||||||||||||||
| 124 | return; executed 244 times by 2 tests: return;Executed by:
| 244 | ||||||||||||||||||||||||||||||
| 125 | _sceneY = sceneY; | - | ||||||||||||||||||||||||||||||
| 126 | sceneYChanged(); | - | ||||||||||||||||||||||||||||||
| 127 | } executed 254 times by 2 tests: end of blockExecuted by:
| 254 | ||||||||||||||||||||||||||||||
| 128 | void QQuickTouchPoint::setUniqueId(const QPointingDeviceUniqueId &id) | - | ||||||||||||||||||||||||||||||
| 129 | { | - | ||||||||||||||||||||||||||||||
| 130 | _uniqueId = id; | - | ||||||||||||||||||||||||||||||
| 131 | uniqueIdChanged(); | - | ||||||||||||||||||||||||||||||
| 132 | } executed 486 times by 2 tests: end of blockExecuted by:
| 486 | ||||||||||||||||||||||||||||||
| 133 | QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent) | - | ||||||||||||||||||||||||||||||
| 134 | : QQuickItem(parent), | - | ||||||||||||||||||||||||||||||
| 135 | _minimumTouchPoints(0), | - | ||||||||||||||||||||||||||||||
| 136 | _maximumTouchPoints(0x7fffffff), | - | ||||||||||||||||||||||||||||||
| 137 | _stealMouse(false), | - | ||||||||||||||||||||||||||||||
| 138 | _mouseEnabled(true) | - | ||||||||||||||||||||||||||||||
| 139 | { | - | ||||||||||||||||||||||||||||||
| 140 | setAcceptedMouseButtons(Qt::LeftButton); | - | ||||||||||||||||||||||||||||||
| 141 | setFiltersChildMouseEvents(true); | - | ||||||||||||||||||||||||||||||
| 142 | if (qmlVisualTouchDebugging()
| 0-62 | ||||||||||||||||||||||||||||||
| 143 | setFlag(QQuickItem::ItemHasContents); | - | ||||||||||||||||||||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 145 | setAcceptTouchEvents(true); | - | ||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||||||||
| 149 | } executed 62 times by 4 tests: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||||||||
| 151 | QQuickMultiPointTouchArea::~QQuickMultiPointTouchArea() | - | ||||||||||||||||||||||||||||||
| 152 | { | - | ||||||||||||||||||||||||||||||
| 153 | clearTouchLists(); | - | ||||||||||||||||||||||||||||||
| 154 | for (QObject *obj : qAsConst(_touchPoints)) { | - | ||||||||||||||||||||||||||||||
| 155 | QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj); | - | ||||||||||||||||||||||||||||||
| 156 | if (!dtp->isQmlDefined()
| 0-8 | ||||||||||||||||||||||||||||||
| 157 | delete dtp; never executed: delete dtp; | 0 | ||||||||||||||||||||||||||||||
| 158 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||
| 159 | } executed 62 times by 4 tests: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||||||||
| 160 | int QQuickMultiPointTouchArea::minimumTouchPoints() const | - | ||||||||||||||||||||||||||||||
| 161 | { | - | ||||||||||||||||||||||||||||||
| 162 | return executed 2 times by 1 test: _minimumTouchPoints;return _minimumTouchPoints;Executed by:
executed 2 times by 1 test: return _minimumTouchPoints;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 163 | } | - | ||||||||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||||||||
| 165 | void QQuickMultiPointTouchArea::setMinimumTouchPoints(int num) | - | ||||||||||||||||||||||||||||||
| 166 | { | - | ||||||||||||||||||||||||||||||
| 167 | if (_minimumTouchPoints == num
| 0-30 | ||||||||||||||||||||||||||||||
| 168 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 169 | _minimumTouchPoints = num; | - | ||||||||||||||||||||||||||||||
| 170 | minimumTouchPointsChanged(); | - | ||||||||||||||||||||||||||||||
| 171 | } executed 30 times by 2 tests: end of blockExecuted by:
| 30 | ||||||||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||||||||
| 173 | int QQuickMultiPointTouchArea::maximumTouchPoints() const | - | ||||||||||||||||||||||||||||||
| 174 | { | - | ||||||||||||||||||||||||||||||
| 175 | return executed 2 times by 1 test: _maximumTouchPoints;return _maximumTouchPoints;Executed by:
executed 2 times by 1 test: return _maximumTouchPoints;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 176 | } | - | ||||||||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||||||||
| 178 | void QQuickMultiPointTouchArea::setMaximumTouchPoints(int num) | - | ||||||||||||||||||||||||||||||
| 179 | { | - | ||||||||||||||||||||||||||||||
| 180 | if (_maximumTouchPoints == num
| 0-52 | ||||||||||||||||||||||||||||||
| 181 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 182 | _maximumTouchPoints = num; | - | ||||||||||||||||||||||||||||||
| 183 | maximumTouchPointsChanged(); | - | ||||||||||||||||||||||||||||||
| 184 | } executed 52 times by 2 tests: end of blockExecuted by:
| 52 | ||||||||||||||||||||||||||||||
| 185 | void QQuickMultiPointTouchArea::setMouseEnabled(bool arg) | - | ||||||||||||||||||||||||||||||
| 186 | { | - | ||||||||||||||||||||||||||||||
| 187 | if (_mouseEnabled != arg
| 0-4 | ||||||||||||||||||||||||||||||
| 188 | _mouseEnabled = arg; | - | ||||||||||||||||||||||||||||||
| 189 | if (_mouseTouchPoint && !arg
| 0 | ||||||||||||||||||||||||||||||
| 190 | _mouseTouchPoint = nullptr; never executed: _mouseTouchPoint = nullptr; | 0 | ||||||||||||||||||||||||||||||
| 191 | mouseEnabledChanged(); | - | ||||||||||||||||||||||||||||||
| 192 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 193 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||
| 195 | void QQuickMultiPointTouchArea::touchEvent(QTouchEvent *event) | - | ||||||||||||||||||||||||||||||
| 196 | { | - | ||||||||||||||||||||||||||||||
| 197 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||
| 198 | case executed 66 times by 1 test: QEvent::TouchBegin:case QEvent::TouchBegin:Executed by:
executed 66 times by 1 test: case QEvent::TouchBegin:Executed by:
| 66 | ||||||||||||||||||||||||||||||
| 199 | case executed 106 times by 2 tests: QEvent::TouchUpdate:case QEvent::TouchUpdate:Executed by:
executed 106 times by 2 tests: case QEvent::TouchUpdate:Executed by:
| 106 | ||||||||||||||||||||||||||||||
| 200 | case executed 32 times by 1 test: QEvent::TouchEnd:case QEvent::TouchEnd:Executed by:
executed 32 times by 1 test: {case QEvent::TouchEnd:Executed by:
| 32 | ||||||||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||||||||
| 202 | QQuickWindow *c = window(); | - | ||||||||||||||||||||||||||||||
| 203 | QQuickItem *grabber = c
| 0-204 | ||||||||||||||||||||||||||||||
| 204 | if (grabber
| 0-142 | ||||||||||||||||||||||||||||||
| 205 | QQuickItem *item = this; | - | ||||||||||||||||||||||||||||||
| 206 | while ((
| 2-4 | ||||||||||||||||||||||||||||||
| 207 | if (item == grabber
| 0-4 | ||||||||||||||||||||||||||||||
| 208 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 209 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 210 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 211 | updateTouchData(event); | - | ||||||||||||||||||||||||||||||
| 212 | if (event->type() == QEvent::TouchEnd
| 32-172 | ||||||||||||||||||||||||||||||
| 213 | ungrab(); executed 32 times by 1 test: ungrab();Executed by:
| 32 | ||||||||||||||||||||||||||||||
| 214 | break; executed 204 times by 2 tests: break;Executed by:
| 204 | ||||||||||||||||||||||||||||||
| 215 | } | - | ||||||||||||||||||||||||||||||
| 216 | case never executed: QEvent::TouchCancel:case QEvent::TouchCancel:never executed: case QEvent::TouchCancel: | 0 | ||||||||||||||||||||||||||||||
| 217 | ungrab(); | - | ||||||||||||||||||||||||||||||
| 218 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 219 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 220 | QQuickItem::touchEvent(event); | - | ||||||||||||||||||||||||||||||
| 221 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||||||||
| 223 | } | - | ||||||||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||||||||
| 225 | void QQuickMultiPointTouchArea::grabGesture() | - | ||||||||||||||||||||||||||||||
| 226 | { | - | ||||||||||||||||||||||||||||||
| 227 | _stealMouse = true; | - | ||||||||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||||||||
| 229 | grabMouse(); | - | ||||||||||||||||||||||||||||||
| 230 | setKeepMouseGrab(true); | - | ||||||||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||||||||
| 232 | QVector<int> ids; | - | ||||||||||||||||||||||||||||||
| 233 | ids.reserve(_touchPoints.size()); | - | ||||||||||||||||||||||||||||||
| 234 | for (auto it = _touchPoints.keyBegin(), end = _touchPoints.keyEnd(); it != end
| 6-16 | ||||||||||||||||||||||||||||||
| 235 | if (*
| 2-14 | ||||||||||||||||||||||||||||||
| 236 | ids.append(*it); executed 14 times by 1 test: ids.append(*it);Executed by:
| 14 | ||||||||||||||||||||||||||||||
| 237 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||
| 238 | grabTouchPoints(ids); | - | ||||||||||||||||||||||||||||||
| 239 | setKeepTouchGrab(true); | - | ||||||||||||||||||||||||||||||
| 240 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||||||||
| 242 | void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) | - | ||||||||||||||||||||||||||||||
| 243 | { | - | ||||||||||||||||||||||||||||||
| 244 | bool ended = false; | - | ||||||||||||||||||||||||||||||
| 245 | bool moved = false; | - | ||||||||||||||||||||||||||||||
| 246 | bool started = false; | - | ||||||||||||||||||||||||||||||
| 247 | bool isMouseEvent = false; | - | ||||||||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||||||||
| 249 | clearTouchLists(); | - | ||||||||||||||||||||||||||||||
| 250 | QList<QTouchEvent::TouchPoint> touchPoints; | - | ||||||||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||||||||
| 252 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||
| 253 | case executed 78 times by 1 test: QEvent::TouchBegin:case QEvent::TouchBegin:Executed by:
executed 78 times by 1 test: case QEvent::TouchBegin:Executed by:
| 78 | ||||||||||||||||||||||||||||||
| 254 | case executed 128 times by 2 tests: QEvent::TouchUpdate:case QEvent::TouchUpdate:Executed by:
executed 128 times by 2 tests: case QEvent::TouchUpdate:Executed by:
| 128 | ||||||||||||||||||||||||||||||
| 255 | case executed 36 times by 1 test: QEvent::TouchEnd:case QEvent::TouchEnd:Executed by:
executed 36 times by 1 test: case QEvent::TouchEnd:Executed by:
| 36 | ||||||||||||||||||||||||||||||
| 256 | touchPoints = static_cast<QTouchEvent*>(event)->touchPoints(); | - | ||||||||||||||||||||||||||||||
| 257 | break; executed 242 times by 2 tests: break;Executed by:
| 242 | ||||||||||||||||||||||||||||||
| 258 | case executed 12 times by 1 test: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:Executed by:
executed 12 times by 1 test: case QEvent::MouseButtonPress:Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 259 | case executed 34 times by 1 test: QEvent::MouseMove:case QEvent::MouseMove:Executed by:
executed 34 times by 1 test: case QEvent::MouseMove:Executed by:
| 34 | ||||||||||||||||||||||||||||||
| 260 | case executed 10 times by 1 test: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:Executed by:
executed 10 times by 1 test: {case QEvent::MouseButtonRelease:Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 261 | QMouseEvent *me = static_cast<QMouseEvent*>(event); | - | ||||||||||||||||||||||||||||||
| 262 | _mouseQpaTouchPoint.setPos(me->localPos()); | - | ||||||||||||||||||||||||||||||
| 263 | _mouseQpaTouchPoint.setScenePos(me->windowPos()); | - | ||||||||||||||||||||||||||||||
| 264 | _mouseQpaTouchPoint.setScreenPos(me->screenPos()); | - | ||||||||||||||||||||||||||||||
| 265 | if (event->type() == QEvent::MouseMove
| 22-34 | ||||||||||||||||||||||||||||||
| 266 | _mouseQpaTouchPoint.setState(Qt::TouchPointMoved); executed 34 times by 1 test: _mouseQpaTouchPoint.setState(Qt::TouchPointMoved);Executed by:
| 34 | ||||||||||||||||||||||||||||||
| 267 | else if (event->type() == QEvent::MouseButtonRelease
| 10-12 | ||||||||||||||||||||||||||||||
| 268 | _mouseQpaTouchPoint.setState(Qt::TouchPointReleased); executed 10 times by 1 test: _mouseQpaTouchPoint.setState(Qt::TouchPointReleased);Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 269 | else { | - | ||||||||||||||||||||||||||||||
| 270 | addTouchPoint(me); | - | ||||||||||||||||||||||||||||||
| 271 | started = true; | - | ||||||||||||||||||||||||||||||
| 272 | _mouseQpaTouchPoint.setState(Qt::TouchPointPressed); | - | ||||||||||||||||||||||||||||||
| 273 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 274 | touchPoints << _mouseQpaTouchPoint; | - | ||||||||||||||||||||||||||||||
| 275 | isMouseEvent = true; | - | ||||||||||||||||||||||||||||||
| 276 | break; executed 56 times by 1 test: break;Executed by:
| 56 | ||||||||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||||||||
| 278 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 279 | QMessageLogger(__FILE__, 620, __PRETTY_FUNCTION__).warning("updateTouchData: unhandled event type %d", event->type()); | - | ||||||||||||||||||||||||||||||
| 280 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 281 | } | - | ||||||||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||||||||
| 283 | if (!isMouseEvent
| 56-242 | ||||||||||||||||||||||||||||||
| 284 | QQuickWindow *c = window(); | - | ||||||||||||||||||||||||||||||
| 285 | if (c
| 0-28 | ||||||||||||||||||||||||||||||
| 286 | touchPoints << _mouseQpaTouchPoint; executed 28 times by 1 test: touchPoints << _mouseQpaTouchPoint;Executed by:
| 28 | ||||||||||||||||||||||||||||||
| 287 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||||||||
| 288 | int numTouchPoints = touchPoints.count(); | - | ||||||||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||||||||
| 290 | for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) { | - | ||||||||||||||||||||||||||||||
| 291 | Qt::TouchPointState touchPointState = p.state(); | - | ||||||||||||||||||||||||||||||
| 292 | int id = p.id(); | - | ||||||||||||||||||||||||||||||
| 293 | if (touchPointState & Qt::TouchPointReleased
| 96-494 | ||||||||||||||||||||||||||||||
| 294 | QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id)); | - | ||||||||||||||||||||||||||||||
| 295 | if (!dtp
| 14-82 | ||||||||||||||||||||||||||||||
| 296 | continue; executed 14 times by 1 test: continue;Executed by:
| 14 | ||||||||||||||||||||||||||||||
| 297 | updateTouchPoint(dtp, &p); | - | ||||||||||||||||||||||||||||||
| 298 | dtp->setPressed(false); | - | ||||||||||||||||||||||||||||||
| 299 | _releasedTouchPoints.append(dtp); | - | ||||||||||||||||||||||||||||||
| 300 | _touchPoints.remove(id); | - | ||||||||||||||||||||||||||||||
| 301 | ended = true; | - | ||||||||||||||||||||||||||||||
| 302 | } executed 82 times by 2 tests: end of blockExecuted by:
| 82 | ||||||||||||||||||||||||||||||
| 303 | } executed 576 times by 2 tests: end of blockExecuted by:
| 576 | ||||||||||||||||||||||||||||||
| 304 | if (numTouchPoints >= _minimumTouchPoints
| 10-250 | ||||||||||||||||||||||||||||||
| 305 | for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) { | - | ||||||||||||||||||||||||||||||
| 306 | Qt::TouchPointState touchPointState = p.state(); | - | ||||||||||||||||||||||||||||||
| 307 | int id = p.id(); | - | ||||||||||||||||||||||||||||||
| 308 | if (touchPointState & Qt::TouchPointReleased
| 84-404 | ||||||||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||||||||
| 310 | } executed 84 times by 2 tests: else if (!_touchPoints.contains(id)end of blockExecuted by:
| 84-268 | ||||||||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||||||||
| 312 | addTouchPoint(&p); | - | ||||||||||||||||||||||||||||||
| 313 | started = true; | - | ||||||||||||||||||||||||||||||
| 314 | } executed 136 times by 2 tests: else if (touchPointState & Qt::TouchPointMovedend of blockExecuted by:
| 56-212 | ||||||||||||||||||||||||||||||
| 315 | QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id)); | - | ||||||||||||||||||||||||||||||
| 316 | ((dtp) ? static_cast<void>(0) : qt_assert("dtp", __FILE__, 657)); | - | ||||||||||||||||||||||||||||||
| 317 | _movedTouchPoints.append(dtp); | - | ||||||||||||||||||||||||||||||
| 318 | updateTouchPoint(dtp,&p); | - | ||||||||||||||||||||||||||||||
| 319 | moved = true; | - | ||||||||||||||||||||||||||||||
| 320 | } executed 212 times by 2 tests: else {end of blockExecuted by:
| 212 | ||||||||||||||||||||||||||||||
| 321 | QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id)); | - | ||||||||||||||||||||||||||||||
| 322 | ((dtp) ? static_cast<void>(0) : qt_assert("dtp", __FILE__, 663)); | - | ||||||||||||||||||||||||||||||
| 323 | updateTouchPoint(dtp,&p); | - | ||||||||||||||||||||||||||||||
| 324 | } executed 56 times by 1 test: end of blockExecuted by:
| 56 | ||||||||||||||||||||||||||||||
| 325 | } | - | ||||||||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||
| 328 | if (!_stealMouse
| 22-218 | ||||||||||||||||||||||||||||||
| 329 | bool offerGrab = false; | - | ||||||||||||||||||||||||||||||
| 330 | const int dragThreshold = QGuiApplication::styleHints()->startDragDistance(); | - | ||||||||||||||||||||||||||||||
| 331 | for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) { | - | ||||||||||||||||||||||||||||||
| 332 | if (p.state() == Qt::TouchPointReleased
| 68-280 | ||||||||||||||||||||||||||||||
| 333 | continue; executed 68 times by 1 test: continue;Executed by:
| 68 | ||||||||||||||||||||||||||||||
| 334 | const QPointF ¤tPos = p.scenePos(); | - | ||||||||||||||||||||||||||||||
| 335 | const QPointF &startPos = p.startScenePos(); | - | ||||||||||||||||||||||||||||||
| 336 | if (qAbs(currentPos.x() - startPos.x()) > dragThreshold
| 66-214 | ||||||||||||||||||||||||||||||
| 337 | offerGrab = true; executed 66 times by 2 tests: offerGrab = true;Executed by:
| 66 | ||||||||||||||||||||||||||||||
| 338 | else if (qAbs(currentPos.y() - startPos.y()) > dragThreshold
| 16-198 | ||||||||||||||||||||||||||||||
| 339 | offerGrab = true; executed 16 times by 1 test: offerGrab = true;Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 340 | if (offerGrab
| 82-198 | ||||||||||||||||||||||||||||||
| 341 | break; executed 82 times by 2 tests: break;Executed by:
| 82 | ||||||||||||||||||||||||||||||
| 342 | } executed 198 times by 2 tests: end of blockExecuted by:
| 198 | ||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||
| 344 | if (offerGrab
| 82-136 | ||||||||||||||||||||||||||||||
| 345 | QQuickGrabGestureEvent event; | - | ||||||||||||||||||||||||||||||
| 346 | event._touchPoints = _touchPoints.values(); | - | ||||||||||||||||||||||||||||||
| 347 | gestureStarted(&event); | - | ||||||||||||||||||||||||||||||
| 348 | if (event.wantsGrab()
| 6-76 | ||||||||||||||||||||||||||||||
| 349 | grabGesture(); executed 6 times by 1 test: grabGesture();Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 350 | } executed 82 times by 2 tests: end of blockExecuted by:
| 82 | ||||||||||||||||||||||||||||||
| 351 | } executed 218 times by 2 tests: end of blockExecuted by:
| 218 | ||||||||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||||||||
| 353 | if (ended
| 50-190 | ||||||||||||||||||||||||||||||
| 354 | released(_releasedTouchPoints); executed 50 times by 2 tests: released(_releasedTouchPoints);Executed by:
| 50 | ||||||||||||||||||||||||||||||
| 355 | if (moved
| 98-142 | ||||||||||||||||||||||||||||||
| 356 | updated(_movedTouchPoints); executed 98 times by 2 tests: updated(_movedTouchPoints);Executed by:
| 98 | ||||||||||||||||||||||||||||||
| 357 | if (started
| 102-138 | ||||||||||||||||||||||||||||||
| 358 | pressed(_pressedTouchPoints); executed 102 times by 2 tests: pressed(_pressedTouchPoints);Executed by:
| 102 | ||||||||||||||||||||||||||||||
| 359 | if (ended
executed 232 times by 2 tests: touchUpdated(_touchPoints.values());Executed by:
| 8-232 | ||||||||||||||||||||||||||||||
| 360 | } executed 240 times by 2 tests: end of blockExecuted by:
| 240 | ||||||||||||||||||||||||||||||
| 361 | } executed 298 times by 2 tests: end of blockExecuted by:
| 298 | ||||||||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||||||||
| 363 | void QQuickMultiPointTouchArea::clearTouchLists() | - | ||||||||||||||||||||||||||||||
| 364 | { | - | ||||||||||||||||||||||||||||||
| 365 | for (QObject *obj : qAsConst(_releasedTouchPoints)) { | - | ||||||||||||||||||||||||||||||
| 366 | QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj); | - | ||||||||||||||||||||||||||||||
| 367 | if (!dtp->isQmlDefined()
| 20-54 | ||||||||||||||||||||||||||||||
| 368 | _touchPoints.remove(dtp->pointId()); | - | ||||||||||||||||||||||||||||||
| 369 | delete dtp; | - | ||||||||||||||||||||||||||||||
| 370 | } executed 20 times by 1 test: else {end of blockExecuted by:
| 20 | ||||||||||||||||||||||||||||||
| 371 | dtp->setInUse(false); | - | ||||||||||||||||||||||||||||||
| 372 | } executed 54 times by 2 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||||||||||||||
| 373 | } | - | ||||||||||||||||||||||||||||||
| 374 | _releasedTouchPoints.clear(); | - | ||||||||||||||||||||||||||||||
| 375 | _pressedTouchPoints.clear(); | - | ||||||||||||||||||||||||||||||
| 376 | _movedTouchPoints.clear(); | - | ||||||||||||||||||||||||||||||
| 377 | } executed 396 times by 4 tests: end of blockExecuted by:
| 396 | ||||||||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||||||||
| 379 | void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) | - | ||||||||||||||||||||||||||||||
| 380 | { | - | ||||||||||||||||||||||||||||||
| 381 | QQuickTouchPoint *dtp = nullptr; | - | ||||||||||||||||||||||||||||||
| 382 | for (QQuickTouchPoint* tp : qAsConst(_touchPrototypes)) { | - | ||||||||||||||||||||||||||||||
| 383 | if (!tp->inUse()
| 78-90 | ||||||||||||||||||||||||||||||
| 384 | tp->setInUse(true); | - | ||||||||||||||||||||||||||||||
| 385 | dtp = tp; | - | ||||||||||||||||||||||||||||||
| 386 | break; executed 90 times by 2 tests: break;Executed by:
| 90 | ||||||||||||||||||||||||||||||
| 387 | } | - | ||||||||||||||||||||||||||||||
| 388 | } executed 78 times by 2 tests: end of blockExecuted by:
| 78 | ||||||||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||||||||
| 390 | if (dtp == nullptr
| 46-90 | ||||||||||||||||||||||||||||||
| 391 | dtp = new QQuickTouchPoint(false); executed 46 times by 1 test: dtp = new QQuickTouchPoint(false);Executed by:
| 46 | ||||||||||||||||||||||||||||||
| 392 | dtp->setPointId(p->id()); | - | ||||||||||||||||||||||||||||||
| 393 | updateTouchPoint(dtp,p); | - | ||||||||||||||||||||||||||||||
| 394 | dtp->setPressed(true); | - | ||||||||||||||||||||||||||||||
| 395 | _touchPoints.insert(p->id(),dtp); | - | ||||||||||||||||||||||||||||||
| 396 | _pressedTouchPoints.append(dtp); | - | ||||||||||||||||||||||||||||||
| 397 | } executed 136 times by 2 tests: end of blockExecuted by:
| 136 | ||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||
| 399 | void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e) | - | ||||||||||||||||||||||||||||||
| 400 | { | - | ||||||||||||||||||||||||||||||
| 401 | QQuickTouchPoint *dtp = nullptr; | - | ||||||||||||||||||||||||||||||
| 402 | for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes)) | - | ||||||||||||||||||||||||||||||
| 403 | if (!tp->inUse()
| 4-8 | ||||||||||||||||||||||||||||||
| 404 | tp->setInUse(true); | - | ||||||||||||||||||||||||||||||
| 405 | dtp = tp; | - | ||||||||||||||||||||||||||||||
| 406 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 407 | } | - | ||||||||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||||||||
| 409 | if (dtp == nullptr
| 4-8 | ||||||||||||||||||||||||||||||
| 410 | dtp = new QQuickTouchPoint(false); executed 4 times by 1 test: dtp = new QQuickTouchPoint(false);Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 411 | updateTouchPoint(dtp, e); | - | ||||||||||||||||||||||||||||||
| 412 | dtp->setPressed(true); | - | ||||||||||||||||||||||||||||||
| 413 | _touchPoints.insert(-1, dtp); | - | ||||||||||||||||||||||||||||||
| 414 | _pressedTouchPoints.append(dtp); | - | ||||||||||||||||||||||||||||||
| 415 | _mouseTouchPoint = dtp; | - | ||||||||||||||||||||||||||||||
| 416 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 417 | void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype) | - | ||||||||||||||||||||||||||||||
| 418 | { | - | ||||||||||||||||||||||||||||||
| 419 | int id = _touchPrototypes.count(); | - | ||||||||||||||||||||||||||||||
| 420 | prototype->setPointId(id); | - | ||||||||||||||||||||||||||||||
| 421 | _touchPrototypes.insert(id, prototype); | - | ||||||||||||||||||||||||||||||
| 422 | } executed 120 times by 3 tests: end of blockExecuted by:
| 120 | ||||||||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||||||||
| 424 | void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QTouchEvent::TouchPoint *p) | - | ||||||||||||||||||||||||||||||
| 425 | { | - | ||||||||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||
| 428 | dtp->setUniqueId(p->uniqueId()); | - | ||||||||||||||||||||||||||||||
| 429 | dtp->setX(p->pos().x()); | - | ||||||||||||||||||||||||||||||
| 430 | dtp->setY(p->pos().y()); | - | ||||||||||||||||||||||||||||||
| 431 | dtp->setEllipseDiameters(p->ellipseDiameters()); | - | ||||||||||||||||||||||||||||||
| 432 | dtp->setPressure(p->pressure()); | - | ||||||||||||||||||||||||||||||
| 433 | dtp->setRotation(p->rotation()); | - | ||||||||||||||||||||||||||||||
| 434 | dtp->setVelocity(p->velocity()); | - | ||||||||||||||||||||||||||||||
| 435 | dtp->setArea(p->rect()); | - | ||||||||||||||||||||||||||||||
| 436 | dtp->setStartX(p->startPos().x()); | - | ||||||||||||||||||||||||||||||
| 437 | dtp->setStartY(p->startPos().y()); | - | ||||||||||||||||||||||||||||||
| 438 | dtp->setPreviousX(p->lastPos().x()); | - | ||||||||||||||||||||||||||||||
| 439 | dtp->setPreviousY(p->lastPos().y()); | - | ||||||||||||||||||||||||||||||
| 440 | dtp->setSceneX(p->scenePos().x()); | - | ||||||||||||||||||||||||||||||
| 441 | dtp->setSceneY(p->scenePos().y()); | - | ||||||||||||||||||||||||||||||
| 442 | } executed 486 times by 2 tests: end of blockExecuted by:
| 486 | ||||||||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||||||||
| 444 | void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QMouseEvent *e) | - | ||||||||||||||||||||||||||||||
| 445 | { | - | ||||||||||||||||||||||||||||||
| 446 | dtp->setPreviousX(dtp->x()); | - | ||||||||||||||||||||||||||||||
| 447 | dtp->setPreviousY(dtp->y()); | - | ||||||||||||||||||||||||||||||
| 448 | dtp->setX(e->localPos().x()); | - | ||||||||||||||||||||||||||||||
| 449 | dtp->setY(e->localPos().y()); | - | ||||||||||||||||||||||||||||||
| 450 | if (e->type() == QEvent::MouseButtonPress
| 0-12 | ||||||||||||||||||||||||||||||
| 451 | dtp->setStartX(e->localPos().x()); | - | ||||||||||||||||||||||||||||||
| 452 | dtp->setStartY(e->localPos().y()); | - | ||||||||||||||||||||||||||||||
| 453 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 454 | dtp->setSceneX(e->windowPos().x()); | - | ||||||||||||||||||||||||||||||
| 455 | dtp->setSceneY(e->windowPos().y()); | - | ||||||||||||||||||||||||||||||
| 456 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||||||||
| 458 | void QQuickMultiPointTouchArea::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
| 459 | { | - | ||||||||||||||||||||||||||||||
| 460 | if (!isEnabled()
| 0-44 | ||||||||||||||||||||||||||||||
| 461 | QQuickItem::mousePressEvent(event); | - | ||||||||||||||||||||||||||||||
| 462 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 463 | } | - | ||||||||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||||||||
| 465 | _stealMouse = false; | - | ||||||||||||||||||||||||||||||
| 466 | setKeepMouseGrab(false); | - | ||||||||||||||||||||||||||||||
| 467 | event->setAccepted(true); | - | ||||||||||||||||||||||||||||||
| 468 | _mousePos = event->localPos(); | - | ||||||||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||||||||
| 470 | if (event->source() != Qt::MouseEventNotSynthesized
| 16-24 | ||||||||||||||||||||||||||||||
| 471 | return; executed 24 times by 1 test: return;Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||||||||
| 473 | if (_touchPoints.count() >= _minimumTouchPoints - 1
| 0-16 | ||||||||||||||||||||||||||||||
| 474 | updateTouchData(event); | - | ||||||||||||||||||||||||||||||
| 475 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 476 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||||||||
| 478 | void QQuickMultiPointTouchArea::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
| 479 | { | - | ||||||||||||||||||||||||||||||
| 480 | if (!isEnabled()
| 0-42 | ||||||||||||||||||||||||||||||
| 481 | QQuickItem::mouseMoveEvent(event); | - | ||||||||||||||||||||||||||||||
| 482 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 483 | } | - | ||||||||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||||||||
| 485 | if (event->source() != Qt::MouseEventNotSynthesized
| 8-34 | ||||||||||||||||||||||||||||||
| 486 | return; executed 8 times by 1 test: return;Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||||||||
| 488 | _movedTouchPoints.clear(); | - | ||||||||||||||||||||||||||||||
| 489 | updateTouchData(event); | - | ||||||||||||||||||||||||||||||
| 490 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||||||||
| 492 | void QQuickMultiPointTouchArea::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
| 493 | { | - | ||||||||||||||||||||||||||||||
| 494 | _stealMouse = false; | - | ||||||||||||||||||||||||||||||
| 495 | if (!isEnabled()
| 0-22 | ||||||||||||||||||||||||||||||
| 496 | QQuickItem::mouseReleaseEvent(event); | - | ||||||||||||||||||||||||||||||
| 497 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 498 | } | - | ||||||||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||||||||
| 500 | if (event->source() != Qt::MouseEventNotSynthesized
| 6-16 | ||||||||||||||||||||||||||||||
| 501 | return; executed 6 times by 1 test: return;Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||||||||
| 503 | if (_mouseTouchPoint
| 6-10 | ||||||||||||||||||||||||||||||
| 504 | updateTouchData(event); | - | ||||||||||||||||||||||||||||||
| 505 | _mouseTouchPoint->setInUse(false); | - | ||||||||||||||||||||||||||||||
| 506 | _releasedTouchPoints.removeAll(_mouseTouchPoint); | - | ||||||||||||||||||||||||||||||
| 507 | _mouseTouchPoint = nullptr; | - | ||||||||||||||||||||||||||||||
| 508 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||||||||
| 510 | QQuickWindow *c = window(); | - | ||||||||||||||||||||||||||||||
| 511 | if (c
| 0-16 | ||||||||||||||||||||||||||||||
| 512 | ungrabMouse(); executed 16 times by 1 test: ungrabMouse();Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 513 | setKeepMouseGrab(false); | - | ||||||||||||||||||||||||||||||
| 514 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||||||||
| 516 | void QQuickMultiPointTouchArea::ungrab() | - | ||||||||||||||||||||||||||||||
| 517 | { | - | ||||||||||||||||||||||||||||||
| 518 | _stealMouse = false; | - | ||||||||||||||||||||||||||||||
| 519 | setKeepMouseGrab(false); | - | ||||||||||||||||||||||||||||||
| 520 | setKeepTouchGrab(false); | - | ||||||||||||||||||||||||||||||
| 521 | ungrabTouchPoints(); | - | ||||||||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||||||||
| 523 | if (_touchPoints.count()
| 36-96 | ||||||||||||||||||||||||||||||
| 524 | for (QObject *obj : qAsConst(_touchPoints)) | - | ||||||||||||||||||||||||||||||
| 525 | static_cast< executed 58 times by 2 tests: QQuickTouchPoint*>(obj)->setPressed(false);static_cast<QQuickTouchPoint*>(obj)->setPressed(false);Executed by:
executed 58 times by 2 tests: static_cast<QQuickTouchPoint*>(obj)->setPressed(false);Executed by:
| 58 | ||||||||||||||||||||||||||||||
| 526 | canceled(_touchPoints.values()); | - | ||||||||||||||||||||||||||||||
| 527 | clearTouchLists(); | - | ||||||||||||||||||||||||||||||
| 528 | for (QObject *obj : qAsConst(_touchPoints)) { | - | ||||||||||||||||||||||||||||||
| 529 | QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj); | - | ||||||||||||||||||||||||||||||
| 530 | if (!dtp->isQmlDefined()
| 28-30 | ||||||||||||||||||||||||||||||
| 531 | delete dtp; executed 28 times by 1 test: delete dtp;Executed by:
| 28 | ||||||||||||||||||||||||||||||
| 532 | else | - | ||||||||||||||||||||||||||||||
| 533 | dtp->setInUse(false); executed 30 times by 2 tests: dtp->setInUse(false);Executed by:
| 30 | ||||||||||||||||||||||||||||||
| 534 | } | - | ||||||||||||||||||||||||||||||
| 535 | _touchPoints.clear(); | - | ||||||||||||||||||||||||||||||
| 536 | touchUpdated(QList<QObject*>()); | - | ||||||||||||||||||||||||||||||
| 537 | } executed 36 times by 2 tests: end of blockExecuted by:
| 36 | ||||||||||||||||||||||||||||||
| 538 | } executed 132 times by 2 tests: end of blockExecuted by:
| 132 | ||||||||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||||||||
| 540 | void QQuickMultiPointTouchArea::mouseUngrabEvent() | - | ||||||||||||||||||||||||||||||
| 541 | { | - | ||||||||||||||||||||||||||||||
| 542 | ungrab(); | - | ||||||||||||||||||||||||||||||
| 543 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||
| 545 | void QQuickMultiPointTouchArea::touchUngrabEvent() | - | ||||||||||||||||||||||||||||||
| 546 | { | - | ||||||||||||||||||||||||||||||
| 547 | ungrab(); | - | ||||||||||||||||||||||||||||||
| 548 | } executed 66 times by 2 tests: end of blockExecuted by:
| 66 | ||||||||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||||||||
| 550 | bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
| 551 | { | - | ||||||||||||||||||||||||||||||
| 552 | QPointF localPos = mapFromScene(event->windowPos()); | - | ||||||||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||||||||
| 554 | QQuickWindow *c = window(); | - | ||||||||||||||||||||||||||||||
| 555 | QQuickItem *grabber = c
| 0-42 | ||||||||||||||||||||||||||||||
| 556 | bool stealThisEvent = _stealMouse; | - | ||||||||||||||||||||||||||||||
| 557 | if ((stealThisEvent
| 0-42 | ||||||||||||||||||||||||||||||
| 558 | QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(), | - | ||||||||||||||||||||||||||||||
| 559 | event->button(), event->buttons(), event->modifiers()); | - | ||||||||||||||||||||||||||||||
| 560 | mouseEvent.setAccepted(false); | - | ||||||||||||||||||||||||||||||
| 561 | QGuiApplicationPrivate::setMouseEventCapsAndVelocity(&mouseEvent, | - | ||||||||||||||||||||||||||||||
| 562 | QGuiApplicationPrivate::mouseEventCaps(event), | - | ||||||||||||||||||||||||||||||
| 563 | QGuiApplicationPrivate::mouseEventVelocity(event)); | - | ||||||||||||||||||||||||||||||
| 564 | QGuiApplicationPrivate::setMouseEventSource(&mouseEvent, Qt::MouseEventSynthesizedByQt); | - | ||||||||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||||||||
| 566 | switch (mouseEvent.type()) { | - | ||||||||||||||||||||||||||||||
| 567 | case executed 8 times by 1 test: QEvent::MouseMove:case QEvent::MouseMove:Executed by:
executed 8 times by 1 test: case QEvent::MouseMove:Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 568 | mouseMoveEvent(&mouseEvent); | - | ||||||||||||||||||||||||||||||
| 569 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 570 | case executed 24 times by 1 test: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:Executed by:
executed 24 times by 1 test: case QEvent::MouseButtonPress:Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 571 | mousePressEvent(&mouseEvent); | - | ||||||||||||||||||||||||||||||
| 572 | break; executed 24 times by 1 test: break;Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 573 | case executed 6 times by 1 test: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:Executed by:
executed 6 times by 1 test: case QEvent::MouseButtonRelease:Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 574 | mouseReleaseEvent(&mouseEvent); | - | ||||||||||||||||||||||||||||||
| 575 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 576 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 577 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 578 | } | - | ||||||||||||||||||||||||||||||
| 579 | grabber = c
| 0-38 | ||||||||||||||||||||||||||||||
| 580 | if (grabber
| 0-24 | ||||||||||||||||||||||||||||||
| 581 | grabMouse(); never executed: grabMouse(); | 0 | ||||||||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||||||||
| 583 | return executed 38 times by 1 test: stealThisEvent;return stealThisEvent;Executed by:
executed 38 times by 1 test: return stealThisEvent;Executed by:
| 38 | ||||||||||||||||||||||||||||||
| 584 | } | - | ||||||||||||||||||||||||||||||
| 585 | if (event->type() == QEvent::MouseButtonRelease
| 2 | ||||||||||||||||||||||||||||||
| 586 | _stealMouse = false; | - | ||||||||||||||||||||||||||||||
| 587 | if (c
| 0-2 | ||||||||||||||||||||||||||||||
| 588 | ungrabMouse(); never executed: ungrabMouse(); | 0 | ||||||||||||||||||||||||||||||
| 589 | setKeepMouseGrab(false); | - | ||||||||||||||||||||||||||||||
| 590 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 591 | return executed 4 times by 1 test: false;return false;Executed by:
executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 592 | } | - | ||||||||||||||||||||||||||||||
| 593 | - | |||||||||||||||||||||||||||||||
| 594 | bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEvent *event) | - | ||||||||||||||||||||||||||||||
| 595 | { | - | ||||||||||||||||||||||||||||||
| 596 | if (!isEnabled()
| 0-84 | ||||||||||||||||||||||||||||||
| 597 | return never executed: QQuickItem::childMouseEventFilter(receiver, event);return QQuickItem::childMouseEventFilter(receiver, event);never executed: return QQuickItem::childMouseEventFilter(receiver, event); | 0 | ||||||||||||||||||||||||||||||
| 598 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||
| 599 | case executed 24 times by 1 test: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:Executed by:
executed 24 times by 1 test: case QEvent::MouseButtonPress:Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 600 | case executed 10 times by 1 test: QEvent::MouseMove:case QEvent::MouseMove:Executed by:
executed 10 times by 1 test: case QEvent::MouseMove:Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 601 | case executed 8 times by 1 test: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:Executed by:
executed 8 times by 1 test: case QEvent::MouseButtonRelease:Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 602 | return executed 42 times by 1 test: sendMouseEvent(static_cast<QMouseEvent *>(event));return sendMouseEvent(static_cast<QMouseEvent *>(event));Executed by:
executed 42 times by 1 test: return sendMouseEvent(static_cast<QMouseEvent *>(event));Executed by:
| 42 | ||||||||||||||||||||||||||||||
| 603 | break; dead code: break; | - | ||||||||||||||||||||||||||||||
| 604 | case executed 12 times by 1 test: QEvent::TouchBegin:case QEvent::TouchBegin:Executed by:
executed 12 times by 1 test: case QEvent::TouchBegin:Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 605 | case executed 24 times by 1 test: QEvent::TouchUpdate:case QEvent::TouchUpdate:Executed by:
executed 24 times by 1 test: case QEvent::TouchUpdate:Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 606 | if (!shouldFilter(event)
| 2-34 | ||||||||||||||||||||||||||||||
| 607 | return executed 2 times by 1 test: false;return false;Executed by:
executed 2 times by 1 test: return false;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 608 | updateTouchData(event); | - | ||||||||||||||||||||||||||||||
| 609 | return executed 34 times by 1 test: _stealMouse;return _stealMouse;Executed by:
executed 34 times by 1 test: return _stealMouse;Executed by:
| 34 | ||||||||||||||||||||||||||||||
| 610 | case executed 6 times by 1 test: QEvent::TouchEnd:case QEvent::TouchEnd:Executed by:
executed 6 times by 1 test: {case QEvent::TouchEnd:Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 611 | if (!shouldFilter(event)
| 2-4 | ||||||||||||||||||||||||||||||
| 612 | return executed 2 times by 1 test: false;return false;Executed by:
executed 2 times by 1 test: return false;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 613 | updateTouchData(event); | - | ||||||||||||||||||||||||||||||
| 614 | ungrab(); | - | ||||||||||||||||||||||||||||||
| 615 | } | - | ||||||||||||||||||||||||||||||
| 616 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 617 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 618 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 619 | } | - | ||||||||||||||||||||||||||||||
| 620 | return executed 4 times by 1 test: QQuickItem::childMouseEventFilter(receiver, event);return QQuickItem::childMouseEventFilter(receiver, event);Executed by:
executed 4 times by 1 test: return QQuickItem::childMouseEventFilter(receiver, event);Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 621 | } | - | ||||||||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||||||||
| 623 | bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event) | - | ||||||||||||||||||||||||||||||
| 624 | { | - | ||||||||||||||||||||||||||||||
| 625 | QQuickWindow *c = window(); | - | ||||||||||||||||||||||||||||||
| 626 | QQuickItem *grabber = c
| 0-42 | ||||||||||||||||||||||||||||||
| 627 | bool disabledItem = grabber
| 0-22 | ||||||||||||||||||||||||||||||
| 628 | bool stealThisEvent = _stealMouse; | - | ||||||||||||||||||||||||||||||
| 629 | bool containsPoint = false; | - | ||||||||||||||||||||||||||||||
| 630 | if (!stealThisEvent
| 0-42 | ||||||||||||||||||||||||||||||
| 631 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||
| 632 | case never executed: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||||||||||||||||||||
| 633 | case never executed: QEvent::MouseMove:case QEvent::MouseMove:never executed: case QEvent::MouseMove: | 0 | ||||||||||||||||||||||||||||||
| 634 | case never executed: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:never executed: {case QEvent::MouseButtonRelease: | 0 | ||||||||||||||||||||||||||||||
| 635 | QMouseEvent *me = static_cast<QMouseEvent*>(event); | - | ||||||||||||||||||||||||||||||
| 636 | containsPoint = contains(mapFromScene(me->windowPos())); | - | ||||||||||||||||||||||||||||||
| 637 | } | - | ||||||||||||||||||||||||||||||
| 638 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 639 | case executed 12 times by 1 test: QEvent::TouchBegin:case QEvent::TouchBegin:Executed by:
executed 12 times by 1 test: case QEvent::TouchBegin:Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 640 | case executed 24 times by 1 test: QEvent::TouchUpdate:case QEvent::TouchUpdate:Executed by:
executed 24 times by 1 test: case QEvent::TouchUpdate:Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 641 | case executed 6 times by 1 test: QEvent::TouchEnd:case QEvent::TouchEnd:Executed by:
executed 6 times by 1 test: {case QEvent::TouchEnd:Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 642 | QTouchEvent *te = static_cast<QTouchEvent*>(event); | - | ||||||||||||||||||||||||||||||
| 643 | for (const QTouchEvent::TouchPoint &point : te->touchPoints()) { | - | ||||||||||||||||||||||||||||||
| 644 | if (contains(mapFromScene(point.scenePos()))
| 0-42 | ||||||||||||||||||||||||||||||
| 645 | containsPoint = true; | - | ||||||||||||||||||||||||||||||
| 646 | break; executed 42 times by 1 test: break;Executed by:
| 42 | ||||||||||||||||||||||||||||||
| 647 | } | - | ||||||||||||||||||||||||||||||
| 648 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 649 | } | - | ||||||||||||||||||||||||||||||
| 650 | break; executed 42 times by 1 test: break;Executed by:
| 42 | ||||||||||||||||||||||||||||||
| 651 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 652 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 653 | } | - | ||||||||||||||||||||||||||||||
| 654 | } | - | ||||||||||||||||||||||||||||||
| 655 | if ((stealThisEvent
| 0-42 | ||||||||||||||||||||||||||||||
| 656 | return executed 38 times by 1 test: true;return true;Executed by:
executed 38 times by 1 test: return true;Executed by:
| 38 | ||||||||||||||||||||||||||||||
| 657 | } | - | ||||||||||||||||||||||||||||||
| 658 | ungrab(); | - | ||||||||||||||||||||||||||||||
| 659 | return executed 4 times by 1 test: false;return false;Executed by:
executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 660 | } | - | ||||||||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||||||||
| 662 | QSGNode *QQuickMultiPointTouchArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) | - | ||||||||||||||||||||||||||||||
| 663 | { | - | ||||||||||||||||||||||||||||||
| 664 | (void)data;; | - | ||||||||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||||||||
| 666 | if (!qmlVisualTouchDebugging()
| 0 | ||||||||||||||||||||||||||||||
| 667 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||||||||
| 669 | QSGInternalRectangleNode *rectangle = static_cast<QSGInternalRectangleNode *>(oldNode); | - | ||||||||||||||||||||||||||||||
| 670 | if (!rectangle
never executed: rectangle = QQuickItemPrivate::get(this)->sceneGraphContext()->createInternalRectangleNode(); | 0 | ||||||||||||||||||||||||||||||
| 671 | - | |||||||||||||||||||||||||||||||
| 672 | rectangle->setRect(QRectF(0, 0, width(), height())); | - | ||||||||||||||||||||||||||||||
| 673 | rectangle->setColor(QColor(255, 0, 0, 50)); | - | ||||||||||||||||||||||||||||||
| 674 | rectangle->update(); | - | ||||||||||||||||||||||||||||||
| 675 | return never executed: rectangle;return rectangle;never executed: return rectangle; | 0 | ||||||||||||||||||||||||||||||
| 676 | } | - | ||||||||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||||||||
| 678 | - | |||||||||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |