| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/handlers/qquicksinglepointhandler.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | extern const QLoggingCategory &DBG_TOUCH_TARGET(); | - | ||||||||||||||||||||||||
| 4 | QQuickSinglePointHandler::QQuickSinglePointHandler(QObject *parent) | - | ||||||||||||||||||||||||
| 5 | : QQuickPointerDeviceHandler(parent) | - | ||||||||||||||||||||||||
| 6 | , m_ignoreAdditionalPoints(false) | - | ||||||||||||||||||||||||
| 7 | { | - | ||||||||||||||||||||||||
| 8 | } executed 1000 times by 5 tests: end of blockExecuted by:
| 1000 | ||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
| 11 | { | - | ||||||||||||||||||||||||
| 12 | if (!QQuickPointerDeviceHandler::wantsPointerEvent(event)
| 0-2605 | ||||||||||||||||||||||||
| 13 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 14 | if (event->device()->pointerType() != QQuickPointerDevice::Finger
| 310-2295 | ||||||||||||||||||||||||
| 15 | (
| 0-252 | ||||||||||||||||||||||||
| 16 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | if (m_pointInfo.m_id
| 1035-1570 | ||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | int candidatePointCount = 0; | - | ||||||||||||||||||||||||
| 23 | bool missing = true; | - | ||||||||||||||||||||||||
| 24 | QQuickEventPoint *point = nullptr; | - | ||||||||||||||||||||||||
| 25 | int c = event->pointCount(); | - | ||||||||||||||||||||||||
| 26 | for (int i = 0; i < c
| 1570-2532 | ||||||||||||||||||||||||
| 27 | QQuickEventPoint *p = event->point(i); | - | ||||||||||||||||||||||||
| 28 | const bool found = (p->pointId() == m_pointInfo.m_id); | - | ||||||||||||||||||||||||
| 29 | if (found
| 962-1570 | ||||||||||||||||||||||||
| 30 | missing = false; executed 1570 times by 4 tests: missing = false;Executed by:
| 1570 | ||||||||||||||||||||||||
| 31 | if (wantsEventPoint(p)
| 1184-1348 | ||||||||||||||||||||||||
| 32 | ++candidatePointCount; | - | ||||||||||||||||||||||||
| 33 | if (found
| 62-1286 | ||||||||||||||||||||||||
| 34 | point = p; executed 1286 times by 4 tests: point = p;Executed by:
| 1286 | ||||||||||||||||||||||||
| 35 | } executed 1348 times by 4 tests: end of blockExecuted by:
| 1348 | ||||||||||||||||||||||||
| 36 | } executed 2532 times by 4 tests: end of blockExecuted by:
| 2532 | ||||||||||||||||||||||||
| 37 | if (missing
| 0-1570 | ||||||||||||||||||||||||
| 38 | for (bool qt_category_enabled = DBG_TOUCH_TARGET().isWarningEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 96, __PRETTY_FUNCTION__, DBG_TOUCH_TARGET().categoryName()).warning() << this << "pointId" << hex << m_pointInfo.m_id << "is missing from current event, but was neither canceled nor released"; | 0 | ||||||||||||||||||||||||
| 39 | << "is missing from current event, but was neither canceled nor released"; never executed: QMessageLogger(__FILE__, 96, __PRETTY_FUNCTION__, DBG_TOUCH_TARGET().categoryName()).warning() << this << "pointId" << hex << m_pointInfo.m_id << "is missing from current event, but was neither canceled nor released"; | 0 | ||||||||||||||||||||||||
| 40 | if (point
| 284-1286 | ||||||||||||||||||||||||
| 41 | if (candidatePointCount == 1
| 0-1260 | ||||||||||||||||||||||||
| 42 | point->setAccepted(); | - | ||||||||||||||||||||||||
| 43 | return executed 1260 times by 4 tests: true;return true;Executed by:
executed 1260 times by 4 tests: return true;Executed by:
| 1260 | ||||||||||||||||||||||||
| 44 | } else { | - | ||||||||||||||||||||||||
| 45 | point->cancelAllGrabs(this); | - | ||||||||||||||||||||||||
| 46 | } executed 26 times by 2 tests: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 47 | } else { | - | ||||||||||||||||||||||||
| 48 | return executed 284 times by 3 tests: false;return false;Executed by:
executed 284 times by 3 tests: return false;Executed by:
| 284 | ||||||||||||||||||||||||
| 49 | } | - | ||||||||||||||||||||||||
| 50 | } else { | - | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | int candidatePointCount = 0; | - | ||||||||||||||||||||||||
| 53 | int c = event->pointCount(); | - | ||||||||||||||||||||||||
| 54 | QQuickEventPoint *chosen = nullptr; | - | ||||||||||||||||||||||||
| 55 | for (int i = 0; i < c
| 1035-1937 | ||||||||||||||||||||||||
| 56 | QQuickEventPoint *p = event->point(i); | - | ||||||||||||||||||||||||
| 57 | if (!p->exclusiveGrabber()
| 431-1506 | ||||||||||||||||||||||||
| 58 | if (!chosen
| 264-592 | ||||||||||||||||||||||||
| 59 | chosen = p; executed 592 times by 4 tests: chosen = p;Executed by:
| 592 | ||||||||||||||||||||||||
| 60 | ++candidatePointCount; | - | ||||||||||||||||||||||||
| 61 | } executed 856 times by 4 tests: end of blockExecuted by:
| 856 | ||||||||||||||||||||||||
| 62 | } executed 1937 times by 4 tests: end of blockExecuted by:
| 1937 | ||||||||||||||||||||||||
| 63 | if (chosen
| 140-592 | ||||||||||||||||||||||||
| 64 | setPointId(chosen->pointId()); | - | ||||||||||||||||||||||||
| 65 | chosen->setAccepted(); | - | ||||||||||||||||||||||||
| 66 | } executed 452 times by 4 tests: end of blockExecuted by:
| 452 | ||||||||||||||||||||||||
| 67 | } executed 1035 times by 4 tests: end of blockExecuted by:
| 1035 | ||||||||||||||||||||||||
| 68 | return executed 1061 times by 4 tests: m_pointInfo.m_id;return m_pointInfo.m_id;Executed by:
executed 1061 times by 4 tests: return m_pointInfo.m_id;Executed by:
| 1061 | ||||||||||||||||||||||||
| 69 | } | - | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | void QQuickSinglePointHandler::handlePointerEventImpl(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
| 72 | { | - | ||||||||||||||||||||||||
| 73 | QQuickPointerDeviceHandler::handlePointerEventImpl(event); | - | ||||||||||||||||||||||||
| 74 | QQuickEventPoint *currentPoint = event->pointById(m_pointInfo.m_id); | - | ||||||||||||||||||||||||
| 75 | ((currentPoint) ? static_cast<void>(0) : qt_assert("currentPoint", __FILE__, 133)); | - | ||||||||||||||||||||||||
| 76 | if (!m_pointInfo.m_id
| 0-1712 | ||||||||||||||||||||||||
| 77 | reset(); | - | ||||||||||||||||||||||||
| 78 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 79 | m_pointInfo.reset(currentPoint); | - | ||||||||||||||||||||||||
| 80 | handleEventPoint(currentPoint); | - | ||||||||||||||||||||||||
| 81 | if (currentPoint->state() == QQuickEventPoint::Released
| 200-1512 | ||||||||||||||||||||||||
| 82 | setExclusiveGrab(currentPoint, false); | - | ||||||||||||||||||||||||
| 83 | reset(); | - | ||||||||||||||||||||||||
| 84 | } executed 200 times by 4 tests: end of blockExecuted by:
| 200 | ||||||||||||||||||||||||
| 85 | pointChanged(); | - | ||||||||||||||||||||||||
| 86 | } executed 1712 times by 4 tests: end of blockExecuted by:
| 1712 | ||||||||||||||||||||||||
| 87 | } | - | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | void QQuickSinglePointHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point) | - | ||||||||||||||||||||||||
| 90 | { | - | ||||||||||||||||||||||||
| 91 | if (grabber != this
| 22-498 | ||||||||||||||||||||||||
| 92 | return; executed 22 times by 2 tests: return;Executed by:
| 22 | ||||||||||||||||||||||||
| 93 | switch (stateChange) { | - | ||||||||||||||||||||||||
| 94 | case executed 124 times by 4 tests: QQuickEventPoint::GrabExclusive:case QQuickEventPoint::GrabExclusive:Executed by:
executed 124 times by 4 tests: case QQuickEventPoint::GrabExclusive:Executed by:
| 124 | ||||||||||||||||||||||||
| 95 | m_pointInfo.m_sceneGrabPosition = point->sceneGrabPosition(); | - | ||||||||||||||||||||||||
| 96 | setActive(true); | - | ||||||||||||||||||||||||
| 97 | QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); | - | ||||||||||||||||||||||||
| 98 | break; executed 124 times by 4 tests: break;Executed by:
| 124 | ||||||||||||||||||||||||
| 99 | case executed 176 times by 4 tests: QQuickEventPoint::GrabPassive:case QQuickEventPoint::GrabPassive:Executed by:
executed 176 times by 4 tests: case QQuickEventPoint::GrabPassive:Executed by:
| 176 | ||||||||||||||||||||||||
| 100 | m_pointInfo.m_sceneGrabPosition = point->sceneGrabPosition(); | - | ||||||||||||||||||||||||
| 101 | QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); | - | ||||||||||||||||||||||||
| 102 | break; executed 176 times by 4 tests: break;Executed by:
| 176 | ||||||||||||||||||||||||
| 103 | case executed 50 times by 2 tests: QQuickEventPoint::OverrideGrabPassive:case QQuickEventPoint::OverrideGrabPassive:Executed by:
executed 50 times by 2 tests: case QQuickEventPoint::OverrideGrabPassive:Executed by:
| 50 | ||||||||||||||||||||||||
| 104 | return; executed 50 times by 2 tests: return;Executed by:
| 50 | ||||||||||||||||||||||||
| 105 | case never executed: QQuickEventPoint::UngrabPassive:case QQuickEventPoint::UngrabPassive:never executed: case QQuickEventPoint::UngrabPassive: | 0 | ||||||||||||||||||||||||
| 106 | case executed 114 times by 4 tests: QQuickEventPoint::UngrabExclusive:case QQuickEventPoint::UngrabExclusive:Executed by:
executed 114 times by 4 tests: case QQuickEventPoint::UngrabExclusive:Executed by:
| 114 | ||||||||||||||||||||||||
| 107 | case executed 26 times by 2 tests: QQuickEventPoint::CancelGrabPassive:case QQuickEventPoint::CancelGrabPassive:Executed by:
executed 26 times by 2 tests: case QQuickEventPoint::CancelGrabPassive:Executed by:
| 26 | ||||||||||||||||||||||||
| 108 | case executed 8 times by 1 test: QQuickEventPoint::CancelGrabExclusive:case QQuickEventPoint::CancelGrabExclusive:Executed by:
executed 8 times by 1 test: case QQuickEventPoint::CancelGrabExclusive:Executed by:
| 8 | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); | - | ||||||||||||||||||||||||
| 111 | reset(); | - | ||||||||||||||||||||||||
| 112 | break; executed 148 times by 4 tests: break;Executed by:
| 148 | ||||||||||||||||||||||||
| 113 | } | - | ||||||||||||||||||||||||
| 114 | singlePointGrabChanged(); | - | ||||||||||||||||||||||||
| 115 | } executed 448 times by 4 tests: end of blockExecuted by:
| 448 | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | void QQuickSinglePointHandler::setIgnoreAdditionalPoints(bool v) | - | ||||||||||||||||||||||||
| 118 | { | - | ||||||||||||||||||||||||
| 119 | m_ignoreAdditionalPoints = v; | - | ||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | void QQuickSinglePointHandler::moveTarget(QPointF pos, QQuickEventPoint *point) | - | ||||||||||||||||||||||||
| 123 | { | - | ||||||||||||||||||||||||
| 124 | target()->setPosition(pos); | - | ||||||||||||||||||||||||
| 125 | m_pointInfo.m_scenePosition = point->scenePosition(); | - | ||||||||||||||||||||||||
| 126 | m_pointInfo.m_position = target()->mapFromScene(m_pointInfo.m_scenePosition); | - | ||||||||||||||||||||||||
| 127 | } executed 372 times by 3 tests: end of blockExecuted by:
| 372 | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | void QQuickSinglePointHandler::setPointId(int id) | - | ||||||||||||||||||||||||
| 130 | { | - | ||||||||||||||||||||||||
| 131 | m_pointInfo.m_id = id; | - | ||||||||||||||||||||||||
| 132 | } executed 452 times by 4 tests: end of blockExecuted by:
| 452 | ||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | void QQuickSinglePointHandler::reset() | - | ||||||||||||||||||||||||
| 135 | { | - | ||||||||||||||||||||||||
| 136 | setActive(false); | - | ||||||||||||||||||||||||
| 137 | m_pointInfo.reset(); | - | ||||||||||||||||||||||||
| 138 | } executed 348 times by 4 tests: end of blockExecuted by:
| 348 | ||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |