| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/handlers/qquickpointerhandler.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | const QLoggingCategory &lcPointerHandlerDispatch() { static const QLoggingCategory category("qt.quick.handler.dispatch"); return executed 9228 times by 5 tests: category;return category;Executed by:
executed 9228 times by 5 tests: }return category;Executed by:
| 9228 | ||||||||||||||||||||||||
| 5 | const QLoggingCategory &lcPointerHandlerGrab() { static const QLoggingCategory category("qt.quick.handler.grab"); return executed 1094 times by 5 tests: category;return category;Executed by:
executed 1094 times by 5 tests: }return category;Executed by:
| 1094 | ||||||||||||||||||||||||
| 6 | const QLoggingCategory &lcPointerHandlerActive() { static const QLoggingCategory category("qt.quick.handler.active"); return executed 254 times by 4 tests: category;return category;Executed by:
executed 254 times by 4 tests: }return category;Executed by:
| 254 | ||||||||||||||||||||||||
| 7 | QQuickPointerHandler::QQuickPointerHandler(QObject *parent) | - | ||||||||||||||||||||||||
| 8 | : QObject(*(new QQuickPointerHandlerPrivate), parent) | - | ||||||||||||||||||||||||
| 9 | { | - | ||||||||||||||||||||||||
| 10 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | QQuickPointerHandler::QQuickPointerHandler(QQuickPointerHandlerPrivate &dd, QObject *parent) | - | ||||||||||||||||||||||||
| 13 | : QObject(dd, parent) | - | ||||||||||||||||||||||||
| 14 | { | - | ||||||||||||||||||||||||
| 15 | } executed 1004 times by 5 tests: end of blockExecuted by:
| 1004 | ||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | QQuickPointerHandler::~QQuickPointerHandler() | - | ||||||||||||||||||||||||
| 18 | { | - | ||||||||||||||||||||||||
| 19 | QQuickItem *parItem = parentItem(); | - | ||||||||||||||||||||||||
| 20 | if (parItem
| 0-1016 | ||||||||||||||||||||||||
| 21 | QQuickItemPrivate *p = QQuickItemPrivate::get(parItem); | - | ||||||||||||||||||||||||
| 22 | p->extra.value().pointerHandlers.removeOne(this); | - | ||||||||||||||||||||||||
| 23 | } executed 1016 times by 6 tests: end of blockExecuted by:
| 1016 | ||||||||||||||||||||||||
| 24 | } executed 1016 times by 6 tests: end of blockExecuted by:
| 1016 | ||||||||||||||||||||||||
| 25 | qreal QQuickPointerHandler::margin() const | - | ||||||||||||||||||||||||
| 26 | { | - | ||||||||||||||||||||||||
| 27 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 28 | return executed 6672 times by 5 tests: d->m_margin;return d->m_margin;Executed by:
executed 6672 times by 5 tests: return d->m_margin;Executed by:
| 6672 | ||||||||||||||||||||||||
| 29 | } | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | void QQuickPointerHandler::setMargin(qreal pointDistanceThreshold) | - | ||||||||||||||||||||||||
| 32 | { | - | ||||||||||||||||||||||||
| 33 | QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 34 | if (d->m_margin == pointDistanceThreshold
| 0 | ||||||||||||||||||||||||
| 35 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | d->m_margin = pointDistanceThreshold; | - | ||||||||||||||||||||||||
| 38 | marginChanged(); | - | ||||||||||||||||||||||||
| 39 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 40 | void QQuickPointerHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point) | - | ||||||||||||||||||||||||
| 41 | { | - | ||||||||||||||||||||||||
| 42 | for (bool qt_category_enabled = lcPointerHandlerGrab().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 131, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point << stateChange << grabber; | 0-488 | ||||||||||||||||||||||||
| 43 | ((point) ? static_cast<void>(0) : qt_assert("point", __FILE__, 132)); | - | ||||||||||||||||||||||||
| 44 | if (grabber == this
| 2-486 | ||||||||||||||||||||||||
| 45 | bool wasCanceled = false; | - | ||||||||||||||||||||||||
| 46 | switch (stateChange) { | - | ||||||||||||||||||||||||
| 47 | case executed 182 times by 4 tests: QQuickEventPoint::GrabPassive:case QQuickEventPoint::GrabPassive:Executed by:
executed 182 times by 4 tests: case QQuickEventPoint::GrabPassive:Executed by:
| 182 | ||||||||||||||||||||||||
| 48 | case executed 136 times by 4 tests: QQuickEventPoint::GrabExclusive:case QQuickEventPoint::GrabExclusive:Executed by:
executed 136 times by 4 tests: case QQuickEventPoint::GrabExclusive:Executed by:
| 136 | ||||||||||||||||||||||||
| 49 | break; executed 318 times by 4 tests: break;Executed by:
| 318 | ||||||||||||||||||||||||
| 50 | 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 | ||||||||||||||||||||||||
| 51 | case executed 20 times by 2 tests: QQuickEventPoint::CancelGrabExclusive:case QQuickEventPoint::CancelGrabExclusive:Executed by:
executed 20 times by 2 tests: case QQuickEventPoint::CancelGrabExclusive:Executed by:
| 20 | ||||||||||||||||||||||||
| 52 | wasCanceled = true; | - | ||||||||||||||||||||||||
| 53 | (void)0; | - | ||||||||||||||||||||||||
| 54 | case never executed: case QQuickEventPoint::UngrabPassive:code before this statement executed 46 times by 3 tests: case QQuickEventPoint::UngrabPassive:Executed by:
never executed: QQuickEventPoint::UngrabPassive:case QQuickEventPoint::UngrabPassive:code before this statement executed 46 times by 3 tests: case QQuickEventPoint::UngrabPassive:Executed by:
never executed: case QQuickEventPoint::UngrabPassive: | 0-46 | ||||||||||||||||||||||||
| 55 | case executed 116 times by 4 tests: QQuickEventPoint::UngrabExclusive:case QQuickEventPoint::UngrabExclusive:Executed by:
executed 116 times by 4 tests: case QQuickEventPoint::UngrabExclusive:Executed by:
| 116 | ||||||||||||||||||||||||
| 56 | setActive(false); | - | ||||||||||||||||||||||||
| 57 | point->setAccepted(false); | - | ||||||||||||||||||||||||
| 58 | if (auto par = parentItem()
| 0-162 | ||||||||||||||||||||||||
| 59 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 60 | par->setKeepMouseGrab(d->hadKeepMouseGrab); | - | ||||||||||||||||||||||||
| 61 | par->setKeepTouchGrab(d->hadKeepTouchGrab); | - | ||||||||||||||||||||||||
| 62 | } executed 162 times by 4 tests: end of blockExecuted by:
| 162 | ||||||||||||||||||||||||
| 63 | break; executed 162 times by 4 tests: break;Executed by:
| 162 | ||||||||||||||||||||||||
| 64 | case executed 6 times by 1 test: QQuickEventPoint::OverrideGrabPassive:case QQuickEventPoint::OverrideGrabPassive:Executed by:
executed 6 times by 1 test: case QQuickEventPoint::OverrideGrabPassive:Executed by:
| 6 | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | return; executed 6 times by 1 test: return;Executed by:
| 6 | ||||||||||||||||||||||||
| 68 | } | - | ||||||||||||||||||||||||
| 69 | if (wasCanceled
| 46-434 | ||||||||||||||||||||||||
| 70 | canceled(point); executed 46 times by 3 tests: canceled(point);Executed by:
| 46 | ||||||||||||||||||||||||
| 71 | grabChanged(stateChange, point); | - | ||||||||||||||||||||||||
| 72 | } executed 480 times by 4 tests: end of blockExecuted by:
| 480 | ||||||||||||||||||||||||
| 73 | } executed 482 times by 4 tests: end of blockExecuted by:
| 482 | ||||||||||||||||||||||||
| 74 | void QQuickPointerHandler::setPassiveGrab(QQuickEventPoint *point, bool grab) | - | ||||||||||||||||||||||||
| 75 | { | - | ||||||||||||||||||||||||
| 76 | for (bool qt_category_enabled = lcPointerHandlerGrab().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 181, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point << grab; | 0-182 | ||||||||||||||||||||||||
| 77 | if (grab
| 0-182 | ||||||||||||||||||||||||
| 78 | point->setGrabberPointerHandler(this, false); | - | ||||||||||||||||||||||||
| 79 | } executed 182 times by 4 tests: else {end of blockExecuted by:
| 182 | ||||||||||||||||||||||||
| 80 | point->removePassiveGrabber(this); | - | ||||||||||||||||||||||||
| 81 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 82 | } | - | ||||||||||||||||||||||||
| 83 | bool QQuickPointerHandler::canGrab(QQuickEventPoint *point) | - | ||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||
| 85 | QQuickPointerHandler *existingPhGrabber = point->grabberPointerHandler(); | - | ||||||||||||||||||||||||
| 86 | return executed 156 times by 5 tests: approveGrabTransition(point, this) &&return approveGrabTransition(point, this) && (existingPhGrabber ? existingPhGrabber->approveGrabTransition(point, this) : true);Executed by:
executed 156 times by 5 tests: return approveGrabTransition(point, this) && (existingPhGrabber ? existingPhGrabber->approveGrabTransition(point, this) : true);Executed by:
| 156 | ||||||||||||||||||||||||
| 87 | (existingPhGrabber ? existingPhGrabber->approveGrabTransition(point, this) : true); executed 156 times by 5 tests: return approveGrabTransition(point, this) && (existingPhGrabber ? existingPhGrabber->approveGrabTransition(point, this) : true);Executed by:
| 156 | ||||||||||||||||||||||||
| 88 | } | - | ||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | bool QQuickPointerHandler::approveGrabTransition(QQuickEventPoint *point, QObject *proposedGrabber) | - | ||||||||||||||||||||||||
| 97 | { | - | ||||||||||||||||||||||||
| 98 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 99 | bool allowed = false; | - | ||||||||||||||||||||||||
| 100 | if (proposedGrabber == this
| 12-156 | ||||||||||||||||||||||||
| 101 | QObject* existingGrabber = point->exclusiveGrabber(); | - | ||||||||||||||||||||||||
| 102 | allowed = (
| 0-142 | ||||||||||||||||||||||||
| 103 | if (existingGrabber
| 14-142 | ||||||||||||||||||||||||
| 104 | if (QQuickPointerHandler *existingPhGrabber = point->grabberPointerHandler()
| 0-14 | ||||||||||||||||||||||||
| 105 | if (!allowed
| 0 | ||||||||||||||||||||||||
| 106 | existingPhGrabber->metaObject()->className() != metaObject()->className()
| 0 | ||||||||||||||||||||||||
| 107 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
| 108 | if (!allowed
| 0 | ||||||||||||||||||||||||
| 109 | existingPhGrabber->metaObject()->className() == metaObject()->className()
| 0 | ||||||||||||||||||||||||
| 110 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
| 111 | } never executed: else if ((end of block
| 0-14 | ||||||||||||||||||||||||
| 112 | QQuickItem * existingItemGrabber = point->grabberItem(); | - | ||||||||||||||||||||||||
| 113 | if (existingItemGrabber
| 0-14 | ||||||||||||||||||||||||
| 114 | (existingItemGrabber->keepTouchGrab()
| 0-14 | ||||||||||||||||||||||||
| 115 | allowed = true; executed 14 times by 1 test: allowed = true;Executed by:
| 14 | ||||||||||||||||||||||||
| 116 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 117 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 118 | } executed 156 times by 5 tests: else {end of blockExecuted by:
| 156 | ||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | if (proposedGrabber
| 4-8 | ||||||||||||||||||||||||
| 121 | if ((
| 0-8 | ||||||||||||||||||||||||
| 122 | allowed = true; executed 8 times by 1 test: allowed = true;Executed by:
| 8 | ||||||||||||||||||||||||
| 123 | if (!allowed
| 0-8 | ||||||||||||||||||||||||
| 124 | proposedGrabber->metaObject()->className() != metaObject()->className()
| 0 | ||||||||||||||||||||||||
| 125 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
| 126 | if (!allowed
| 0-8 | ||||||||||||||||||||||||
| 127 | proposedGrabber->metaObject()->className() == metaObject()->className()
| 0 | ||||||||||||||||||||||||
| 128 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
| 129 | if (!allowed
| 0-8 | ||||||||||||||||||||||||
| 130 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
| 131 | } executed 8 times by 1 test: else {end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 132 | if (!allowed
| 0-4 | ||||||||||||||||||||||||
| 133 | allowed = true; executed 4 times by 2 tests: allowed = true;Executed by:
| 4 | ||||||||||||||||||||||||
| 134 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 135 | } | - | ||||||||||||||||||||||||
| 136 | for (bool qt_category_enabled = lcPointerHandlerGrab().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << "point" << hex << point->pointId() << "permission" << QMetaEnum::fromType<GrabPermissions>().valueToKeys(grabPermissions()) << ':' << this << (allowed ? "approved to" : "denied to") << proposedGrabber; | 0-168 | ||||||||||||||||||||||||
| 137 | QMetaEnum::fromType<GrabPermissions>().valueToKeys(grabPermissions()) << never executed: QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << "point" << hex << point->pointId() << "permission" << QMetaEnum::fromType<GrabPermissions>().valueToKeys(grabPermissions()) << ':' << this << (allowed ? "approved to" : "denied to") << proposedGrabber; | 0 | ||||||||||||||||||||||||
| 138 | ':' << this << (allowed ? "approved to" : "denied to") << proposedGrabber; never executed: QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << "point" << hex << point->pointId() << "permission" << QMetaEnum::fromType<GrabPermissions>().valueToKeys(grabPermissions()) << ':' << this << (allowed ? "approved to" : "denied to") << proposedGrabber; | 0 | ||||||||||||||||||||||||
| 139 | return executed 168 times by 5 tests: allowed;return allowed;Executed by:
executed 168 times by 5 tests: return allowed;Executed by:
| 168 | ||||||||||||||||||||||||
| 140 | } | - | ||||||||||||||||||||||||
| 141 | QQuickPointerHandler::GrabPermissions QQuickPointerHandler::grabPermissions() const | - | ||||||||||||||||||||||||
| 142 | { | - | ||||||||||||||||||||||||
| 143 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 144 | return never executed: static_cast<QQuickPointerHandler::GrabPermissions>(d->grabPermissions);return static_cast<QQuickPointerHandler::GrabPermissions>(d->grabPermissions);never executed: return static_cast<QQuickPointerHandler::GrabPermissions>(d->grabPermissions); | 0 | ||||||||||||||||||||||||
| 145 | } | - | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | void QQuickPointerHandler::setGrabPermissions(GrabPermissions grabPermission) | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 150 | if (d->grabPermissions == grabPermission
| 0 | ||||||||||||||||||||||||
| 151 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | d->grabPermissions = grabPermission; | - | ||||||||||||||||||||||||
| 154 | grabPermissionChanged(); | - | ||||||||||||||||||||||||
| 155 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | void QQuickPointerHandler::classBegin() | - | ||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||
| 159 | } | - | ||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | void QQuickPointerHandler::componentComplete() | - | ||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||
| 163 | } | - | ||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | QQuickPointerEvent *QQuickPointerHandler::currentEvent() | - | ||||||||||||||||||||||||
| 166 | { | - | ||||||||||||||||||||||||
| 167 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 168 | return never executed: d->currentEvent;return d->currentEvent;never executed: return d->currentEvent; | 0 | ||||||||||||||||||||||||
| 169 | } | - | ||||||||||||||||||||||||
| 170 | bool QQuickPointerHandler::setExclusiveGrab(QQuickEventPoint *point, bool grab) | - | ||||||||||||||||||||||||
| 171 | { | - | ||||||||||||||||||||||||
| 172 | if ((grab
| 16-246 | ||||||||||||||||||||||||
| 173 | return executed 150 times by 5 tests: true;return true;Executed by:
executed 150 times by 5 tests: return true;Executed by:
| 150 | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | bool allowed = true; | - | ||||||||||||||||||||||||
| 176 | if (grab
| 112-144 | ||||||||||||||||||||||||
| 177 | allowed = canGrab(point); | - | ||||||||||||||||||||||||
| 178 | } executed 144 times by 5 tests: else {end of blockExecuted by:
| 144 | ||||||||||||||||||||||||
| 179 | QQuickPointerHandler *existingPhGrabber = point->grabberPointerHandler(); | - | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | if (existingPhGrabber
| 0-112 | ||||||||||||||||||||||||
| 182 | allowed = false; never executed: allowed = false; | 0 | ||||||||||||||||||||||||
| 183 | } executed 112 times by 4 tests: end of blockExecuted by:
| 112 | ||||||||||||||||||||||||
| 184 | for (bool qt_category_enabled = lcPointerHandlerGrab().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 323, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point << (grab ? "grab" : "ungrab") << (allowed ? "allowed" : "forbidden") << point->exclusiveGrabber() << "->" << (grab ? this : nullptr); | 0-256 | ||||||||||||||||||||||||
| 185 | point->exclusiveGrabber() << "->" << (grab ? this : nullptr); never executed: QMessageLogger(__FILE__, 323, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point << (grab ? "grab" : "ungrab") << (allowed ? "allowed" : "forbidden") << point->exclusiveGrabber() << "->" << (grab ? this : nullptr); | 0 | ||||||||||||||||||||||||
| 186 | if (allowed
| 0-256 | ||||||||||||||||||||||||
| 187 | point->setGrabberPointerHandler(grab ? this : nullptr, true); executed 256 times by 5 tests: point->setGrabberPointerHandler(grab ? this : nullptr, true);Executed by:
| 256 | ||||||||||||||||||||||||
| 188 | return executed 256 times by 5 tests: allowed;return allowed;Executed by:
executed 256 times by 5 tests: return allowed;Executed by:
| 256 | ||||||||||||||||||||||||
| 189 | } | - | ||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | void QQuickPointerHandler::cancelAllGrabs(QQuickEventPoint *point) | - | ||||||||||||||||||||||||
| 195 | { | - | ||||||||||||||||||||||||
| 196 | for (bool qt_category_enabled = lcPointerHandlerGrab().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 335, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point; | 0 | ||||||||||||||||||||||||
| 197 | point->cancelAllGrabs(this); | - | ||||||||||||||||||||||||
| 198 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | QPointF QQuickPointerHandler::eventPos(const QQuickEventPoint *point) const | - | ||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||
| 202 | return executed 84 times by 1 test: (target() ? target()->mapFromScene(point->scenePosition()) : point->scenePosition());return (target() ? target()->mapFromScene(point->scenePosition()) : point->scenePosition());Executed by:
executed 84 times by 1 test: return (target() ? target()->mapFromScene(point->scenePosition()) : point->scenePosition());Executed by:
| 84 | ||||||||||||||||||||||||
| 203 | } | - | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | bool QQuickPointerHandler::parentContains(const QQuickEventPoint *point) const | - | ||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||
| 207 | if (!point
| 0-6718 | ||||||||||||||||||||||||
| 208 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 209 | if (QQuickItem *par = parentItem()
| 0-6718 | ||||||||||||||||||||||||
| 210 | if (par->window()
| 0-6718 | ||||||||||||||||||||||||
| 211 | QPoint screenPosition = par->window()->mapToGlobal(point->scenePosition().toPoint()); | - | ||||||||||||||||||||||||
| 212 | if (!par->window()->geometry().contains(screenPosition)
| 46-6672 | ||||||||||||||||||||||||
| 213 | return executed 46 times by 1 test: false;return false;Executed by:
executed 46 times by 1 test: return false;Executed by:
| 46 | ||||||||||||||||||||||||
| 214 | } executed 6672 times by 5 tests: end of blockExecuted by:
| 6672 | ||||||||||||||||||||||||
| 215 | QPointF p = par->mapFromScene(point->scenePosition()); | - | ||||||||||||||||||||||||
| 216 | qreal m = margin(); | - | ||||||||||||||||||||||||
| 217 | if (m > 0
| 0-6672 | ||||||||||||||||||||||||
| 218 | return never executed: p.x() >= -m && p.y() >= -m && p.x() <= par->width() + m && p.y() <= par->height() + m;return p.x() >= -m && p.y() >= -m && p.x() <= par->width() + m && p.y() <= par->height() + m;never executed: return p.x() >= -m && p.y() >= -m && p.x() <= par->width() + m && p.y() <= par->height() + m; | 0 | ||||||||||||||||||||||||
| 219 | return executed 6672 times by 5 tests: par->contains(p);return par->contains(p);Executed by:
executed 6672 times by 5 tests: return par->contains(p);Executed by:
| 6672 | ||||||||||||||||||||||||
| 220 | } | - | ||||||||||||||||||||||||
| 221 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | bool QQuickPointerHandler::enabled() const | - | ||||||||||||||||||||||||
| 231 | { | - | ||||||||||||||||||||||||
| 232 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 233 | return executed 68 times by 1 test: d->enabled;return d->enabled;Executed by:
executed 68 times by 1 test: return d->enabled;Executed by:
| 68 | ||||||||||||||||||||||||
| 234 | } | - | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | void QQuickPointerHandler::setEnabled(bool enabled) | - | ||||||||||||||||||||||||
| 237 | { | - | ||||||||||||||||||||||||
| 238 | QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 239 | if (d->enabled == enabled
| 0 | ||||||||||||||||||||||||
| 240 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||
| 242 | d->enabled = enabled; | - | ||||||||||||||||||||||||
| 243 | enabledChanged(); | - | ||||||||||||||||||||||||
| 244 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | bool QQuickPointerHandler::active() const | - | ||||||||||||||||||||||||
| 247 | { | - | ||||||||||||||||||||||||
| 248 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 249 | return executed 1135 times by 3 tests: d->active;return d->active;Executed by:
executed 1135 times by 3 tests: return d->active;Executed by:
| 1135 | ||||||||||||||||||||||||
| 250 | } | - | ||||||||||||||||||||||||
| 251 | void QQuickPointerHandler::setTarget(QQuickItem *target) | - | ||||||||||||||||||||||||
| 252 | { | - | ||||||||||||||||||||||||
| 253 | QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 254 | d->targetExplicitlySet = true; | - | ||||||||||||||||||||||||
| 255 | if (d->target == target
| 0-80 | ||||||||||||||||||||||||
| 256 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | QQuickItem *oldTarget = d->target; | - | ||||||||||||||||||||||||
| 259 | d->target = target; | - | ||||||||||||||||||||||||
| 260 | onTargetChanged(oldTarget); | - | ||||||||||||||||||||||||
| 261 | targetChanged(); | - | ||||||||||||||||||||||||
| 262 | } executed 80 times by 2 tests: end of blockExecuted by:
| 80 | ||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | QQuickItem *QQuickPointerHandler::parentItem() const | - | ||||||||||||||||||||||||
| 265 | { | - | ||||||||||||||||||||||||
| 266 | return executed 14311 times by 6 tests: static_cast<QQuickItem *>(QObject::parent());return static_cast<QQuickItem *>(QObject::parent());Executed by:
executed 14311 times by 6 tests: return static_cast<QQuickItem *>(QObject::parent());Executed by:
| 14311 | ||||||||||||||||||||||||
| 267 | } | - | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | QQuickItem *QQuickPointerHandler::target() const | - | ||||||||||||||||||||||||
| 270 | { | - | ||||||||||||||||||||||||
| 271 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 272 | if (!d->targetExplicitlySet
| 2066-2480 | ||||||||||||||||||||||||
| 273 | return executed 2480 times by 3 tests: parentItem();return parentItem();Executed by:
executed 2480 times by 3 tests: return parentItem();Executed by:
| 2480 | ||||||||||||||||||||||||
| 274 | return executed 2066 times by 2 tests: d->target;return d->target;Executed by:
executed 2066 times by 2 tests: return d->target;Executed by:
| 2066 | ||||||||||||||||||||||||
| 275 | } | - | ||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||
| 277 | void QQuickPointerHandler::handlePointerEvent(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
| 278 | { | - | ||||||||||||||||||||||||
| 279 | bool wants = wantsPointerEvent(event); | - | ||||||||||||||||||||||||
| 280 | for (bool qt_category_enabled = lcPointerHandlerDispatch().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 431, __PRETTY_FUNCTION__, lcPointerHandlerDispatch().categoryName()).debug() << metaObject()->className() << objectName() << "on" << parentItem()->metaObject()->className() << parentItem()->objectName() << (wants ? "WANTS" : "DECLINES") << event; | 0-2756 | ||||||||||||||||||||||||
| 281 | << "on" << parentItem()->metaObject()->className() << parentItem()->objectName() never executed: QMessageLogger(__FILE__, 431, __PRETTY_FUNCTION__, lcPointerHandlerDispatch().categoryName()).debug() << metaObject()->className() << objectName() << "on" << parentItem()->metaObject()->className() << parentItem()->objectName() << (wants ? "WANTS" : "DECLINES") << event; | 0 | ||||||||||||||||||||||||
| 282 | << (wants ? "WANTS" : "DECLINES") << event; never executed: QMessageLogger(__FILE__, 431, __PRETTY_FUNCTION__, lcPointerHandlerDispatch().categoryName()).debug() << metaObject()->className() << objectName() << "on" << parentItem()->metaObject()->className() << parentItem()->objectName() << (wants ? "WANTS" : "DECLINES") << event; | 0 | ||||||||||||||||||||||||
| 283 | if (wants
| 945-1811 | ||||||||||||||||||||||||
| 284 | handlePointerEventImpl(event); | - | ||||||||||||||||||||||||
| 285 | } executed 1811 times by 5 tests: else {end of blockExecuted by:
| 1811 | ||||||||||||||||||||||||
| 286 | setActive(false); | - | ||||||||||||||||||||||||
| 287 | int pCount = event->pointCount(); | - | ||||||||||||||||||||||||
| 288 | for (int i = 0; i < pCount
| 945-1791 | ||||||||||||||||||||||||
| 289 | QQuickEventPoint *pt = event->point(i); | - | ||||||||||||||||||||||||
| 290 | if (pt->grabberPointerHandler() == this
| 12-1747 | ||||||||||||||||||||||||
| 291 | pt->cancelExclusiveGrab(); executed 12 times by 1 test: pt->cancelExclusiveGrab();Executed by:
| 12 | ||||||||||||||||||||||||
| 292 | } executed 1791 times by 4 tests: end of blockExecuted by:
| 1791 | ||||||||||||||||||||||||
| 293 | } executed 945 times by 4 tests: end of blockExecuted by:
| 945 | ||||||||||||||||||||||||
| 294 | event->device()->eventDeliveryTargets().append(this); | - | ||||||||||||||||||||||||
| 295 | } executed 2756 times by 5 tests: end of blockExecuted by:
| 2756 | ||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | bool QQuickPointerHandler::wantsPointerEvent(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||
| 299 | const QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 300 | (void)event; | - | ||||||||||||||||||||||||
| 301 | return executed 2756 times by 5 tests: d->enabled;return d->enabled;Executed by:
executed 2756 times by 5 tests: return d->enabled;Executed by:
| 2756 | ||||||||||||||||||||||||
| 302 | } | - | ||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | bool QQuickPointerHandler::wantsEventPoint(QQuickEventPoint *point) | - | ||||||||||||||||||||||||
| 305 | { | - | ||||||||||||||||||||||||
| 306 | bool ret = parentContains(point); | - | ||||||||||||||||||||||||
| 307 | for (bool qt_category_enabled = lcPointerHandlerDispatch().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 458, __PRETTY_FUNCTION__, lcPointerHandlerDispatch().categoryName()).debug() << hex << point->pointId() << "@" << point->scenePosition() << metaObject()->className() << objectName() << ret; | 0-3784 | ||||||||||||||||||||||||
| 308 | << metaObject()->className() << objectName() << ret; never executed: QMessageLogger(__FILE__, 458, __PRETTY_FUNCTION__, lcPointerHandlerDispatch().categoryName()).debug() << hex << point->pointId() << "@" << point->scenePosition() << metaObject()->className() << objectName() << ret; | 0 | ||||||||||||||||||||||||
| 309 | return executed 3784 times by 4 tests: ret;return ret;Executed by:
executed 3784 times by 4 tests: return ret;Executed by:
| 3784 | ||||||||||||||||||||||||
| 310 | } | - | ||||||||||||||||||||||||
| 311 | void QQuickPointerHandler::setActive(bool active) | - | ||||||||||||||||||||||||
| 312 | { | - | ||||||||||||||||||||||||
| 313 | QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 314 | if (d->active != active
| 254-1329 | ||||||||||||||||||||||||
| 315 | for (bool qt_category_enabled = lcPointerHandlerActive().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 477, __PRETTY_FUNCTION__, lcPointerHandlerActive().categoryName()).debug() << this << d->active << "->" << active; | 0-254 | ||||||||||||||||||||||||
| 316 | d->active = active; | - | ||||||||||||||||||||||||
| 317 | onActiveChanged(); | - | ||||||||||||||||||||||||
| 318 | activeChanged(); | - | ||||||||||||||||||||||||
| 319 | } executed 254 times by 4 tests: end of blockExecuted by:
| 254 | ||||||||||||||||||||||||
| 320 | } executed 1583 times by 4 tests: end of blockExecuted by:
| 1583 | ||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||
| 322 | void QQuickPointerHandler::handlePointerEventImpl(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
| 323 | { | - | ||||||||||||||||||||||||
| 324 | QQuickPointerHandlerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 325 | d->currentEvent = event; | - | ||||||||||||||||||||||||
| 326 | } executed 1811 times by 5 tests: end of blockExecuted by:
| 1811 | ||||||||||||||||||||||||
| 327 | QQuickPointerHandlerPrivate::QQuickPointerHandlerPrivate() | - | ||||||||||||||||||||||||
| 328 | : grabPermissions(QQuickPointerHandler::CanTakeOverFromItems | | - | ||||||||||||||||||||||||
| 329 | QQuickPointerHandler::CanTakeOverFromHandlersOfDifferentType | | - | ||||||||||||||||||||||||
| 330 | QQuickPointerHandler::ApprovesTakeOverByAnything) | - | ||||||||||||||||||||||||
| 331 | , enabled(true) | - | ||||||||||||||||||||||||
| 332 | , active(false) | - | ||||||||||||||||||||||||
| 333 | , targetExplicitlySet(false) | - | ||||||||||||||||||||||||
| 334 | , hadKeepMouseGrab(false) | - | ||||||||||||||||||||||||
| 335 | , hadKeepTouchGrab(false) | - | ||||||||||||||||||||||||
| 336 | { | - | ||||||||||||||||||||||||
| 337 | } executed 1016 times by 6 tests: end of blockExecuted by:
| 1016 | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | QQuickPointerHandlerPrivate::~QQuickPointerHandlerPrivate() | - | ||||||||||||||||||||||||
| 340 | { | - | ||||||||||||||||||||||||
| 341 | } | - | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |