Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/handlers/qquickpointerhandler.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||||||||||||||
2 | ** | - | ||||||||||||||||||||||||
3 | ** Copyright (C) 2018 The Qt Company Ltd. | - | ||||||||||||||||||||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
5 | ** | - | ||||||||||||||||||||||||
6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | ||||||||||||||||||||||||
7 | ** | - | ||||||||||||||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||||||||
16 | ** | - | ||||||||||||||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||
24 | ** | - | ||||||||||||||||||||||||
25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||
35 | ** | - | ||||||||||||||||||||||||
36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
37 | ** | - | ||||||||||||||||||||||||
38 | ****************************************************************************/ | - | ||||||||||||||||||||||||
39 | - | |||||||||||||||||||||||||
40 | #include "qquickpointerhandler_p.h" | - | ||||||||||||||||||||||||
41 | #include "qquickpointerhandler_p_p.h" | - | ||||||||||||||||||||||||
42 | #include <QtQuick/private/qquickitem_p.h> | - | ||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
45 | - | |||||||||||||||||||||||||
46 | Q_LOGGING_CATEGORY(lcPointerHandlerDispatch, "qt.quick.handler.dispatch") executed 9228 times by 5 tests: return category; Executed by:
| 9228 | ||||||||||||||||||||||||
47 | Q_LOGGING_CATEGORY(lcPointerHandlerGrab, "qt.quick.handler.grab") executed 1094 times by 5 tests: return category; Executed by:
| 1094 | ||||||||||||||||||||||||
48 | Q_LOGGING_CATEGORY(lcPointerHandlerActive, "qt.quick.handler.active") executed 254 times by 4 tests: return category; Executed by:
| 254 | ||||||||||||||||||||||||
49 | - | |||||||||||||||||||||||||
50 | /*! | - | ||||||||||||||||||||||||
51 | \qmltype PointerHandler | - | ||||||||||||||||||||||||
52 | \qmlabstract | - | ||||||||||||||||||||||||
53 | \since 5.10 | - | ||||||||||||||||||||||||
54 | \preliminary | - | ||||||||||||||||||||||||
55 | \instantiates QQuickPointerHandler | - | ||||||||||||||||||||||||
56 | \inqmlmodule Qt.labs.handlers | - | ||||||||||||||||||||||||
57 | \ingroup qtquick-handlers | - | ||||||||||||||||||||||||
58 | \brief Abstract handler for pointer events. | - | ||||||||||||||||||||||||
59 | - | |||||||||||||||||||||||||
60 | PointerHandler is the base class handler (not registered as a QML type) for | - | ||||||||||||||||||||||||
61 | pointer events without regard to source (touch, mouse or graphics tablet). | - | ||||||||||||||||||||||||
62 | */ | - | ||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||
64 | QQuickPointerHandler::QQuickPointerHandler(QObject *parent) | - | ||||||||||||||||||||||||
65 | : QObject(*(new QQuickPointerHandlerPrivate), parent) | - | ||||||||||||||||||||||||
66 | { | - | ||||||||||||||||||||||||
67 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | QQuickPointerHandler::QQuickPointerHandler(QQuickPointerHandlerPrivate &dd, QObject *parent) | - | ||||||||||||||||||||||||
70 | : QObject(dd, parent) | - | ||||||||||||||||||||||||
71 | { | - | ||||||||||||||||||||||||
72 | } executed 1004 times by 5 tests: end of block Executed by:
| 1004 | ||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||
74 | QQuickPointerHandler::~QQuickPointerHandler() | - | ||||||||||||||||||||||||
75 | { | - | ||||||||||||||||||||||||
76 | QQuickItem *parItem = parentItem(); | - | ||||||||||||||||||||||||
77 | if (parItem) {
| 0-1016 | ||||||||||||||||||||||||
78 | QQuickItemPrivate *p = QQuickItemPrivate::get(parItem); | - | ||||||||||||||||||||||||
79 | p->extra.value().pointerHandlers.removeOne(this); | - | ||||||||||||||||||||||||
80 | } executed 1016 times by 6 tests: end of block Executed by:
| 1016 | ||||||||||||||||||||||||
81 | } executed 1016 times by 6 tests: end of block Executed by:
| 1016 | ||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||
83 | /*! | - | ||||||||||||||||||||||||
84 | \qmlproperty real PointerHandler::margin | - | ||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||
86 | The margin beyond the bounds of the \l {PointerHandler::parent}{parent} | - | ||||||||||||||||||||||||
87 | item within which an event point can activate this handler. For example, on | - | ||||||||||||||||||||||||
88 | a PinchHandler where the \l {PointerHandler::target}{target} is also the | - | ||||||||||||||||||||||||
89 | \c parent, it's useful to set this to a distance at least half the width | - | ||||||||||||||||||||||||
90 | of a typical user's finger, so that if the \c parent has been scaled down | - | ||||||||||||||||||||||||
91 | to a very small size, the pinch gesture is still possible. Or, if a | - | ||||||||||||||||||||||||
92 | TapHandler-based button is placed near the screen edge, it can be used | - | ||||||||||||||||||||||||
93 | to comply with Fitts's Law: react to mouse clicks at the screen edge | - | ||||||||||||||||||||||||
94 | even though the button is visually spaced away from the edge by a few pixels. | - | ||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||
96 | The default value is 0. | - | ||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||
98 | \image pointDistanceThreshold.png | - | ||||||||||||||||||||||||
99 | */ | - | ||||||||||||||||||||||||
100 | qreal QQuickPointerHandler::margin() const | - | ||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||
102 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
103 | return d->m_margin; executed 6672 times by 5 tests: return d->m_margin; Executed by:
| 6672 | ||||||||||||||||||||||||
104 | } | - | ||||||||||||||||||||||||
105 | - | |||||||||||||||||||||||||
106 | void QQuickPointerHandler::setMargin(qreal pointDistanceThreshold) | - | ||||||||||||||||||||||||
107 | { | - | ||||||||||||||||||||||||
108 | Q_D(QQuickPointerHandler); | - | ||||||||||||||||||||||||
109 | if (d->m_margin == pointDistanceThreshold)
| 0 | ||||||||||||||||||||||||
110 | return; never executed: return; | 0 | ||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||
112 | d->m_margin = pointDistanceThreshold; | - | ||||||||||||||||||||||||
113 | emit marginChanged(); | - | ||||||||||||||||||||||||
114 | } never executed: end of block | 0 | ||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||
116 | /*! | - | ||||||||||||||||||||||||
117 | Notification that the grab has changed in some way which is relevant to this handler. | - | ||||||||||||||||||||||||
118 | The \a grabber (subject) will be the PointerHandler whose state is changing, | - | ||||||||||||||||||||||||
119 | or null if the state change regards an Item. | - | ||||||||||||||||||||||||
120 | The \a stateChange (verb) tells what happened. | - | ||||||||||||||||||||||||
121 | The \a point (object) is the point that was grabbed or ungrabbed. | - | ||||||||||||||||||||||||
122 | EventPoint has the sole responsibility to call this function. | - | ||||||||||||||||||||||||
123 | The PointerHandler must react in whatever way is appropriate, and must | - | ||||||||||||||||||||||||
124 | emit the relevant signals (for the benefit of QML code). | - | ||||||||||||||||||||||||
125 | A subclass is allowed to override this virtual function, but must always | - | ||||||||||||||||||||||||
126 | call its parent class's implementation in addition to (usually after) | - | ||||||||||||||||||||||||
127 | whatever custom behavior it implements. | - | ||||||||||||||||||||||||
128 | */ | - | ||||||||||||||||||||||||
129 | void QQuickPointerHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point) | - | ||||||||||||||||||||||||
130 | { | - | ||||||||||||||||||||||||
131 | qCDebug(lcPointerHandlerGrab) << point << stateChange << grabber; never executed: QMessageLogger(__FILE__, 131, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point << stateChange << grabber;
| 0-488 | ||||||||||||||||||||||||
132 | Q_ASSERT(point); | - | ||||||||||||||||||||||||
133 | if (grabber == this) {
| 2-486 | ||||||||||||||||||||||||
134 | bool wasCanceled = false; | - | ||||||||||||||||||||||||
135 | switch (stateChange) { | - | ||||||||||||||||||||||||
136 | case QQuickEventPoint::GrabPassive: executed 182 times by 4 tests: case QQuickEventPoint::GrabPassive: Executed by:
| 182 | ||||||||||||||||||||||||
137 | case QQuickEventPoint::GrabExclusive: executed 136 times by 4 tests: case QQuickEventPoint::GrabExclusive: Executed by:
| 136 | ||||||||||||||||||||||||
138 | break; executed 318 times by 4 tests: break; Executed by:
| 318 | ||||||||||||||||||||||||
139 | case QQuickEventPoint::CancelGrabPassive: executed 26 times by 2 tests: case QQuickEventPoint::CancelGrabPassive: Executed by:
| 26 | ||||||||||||||||||||||||
140 | case QQuickEventPoint::CancelGrabExclusive: executed 20 times by 2 tests: case QQuickEventPoint::CancelGrabExclusive: Executed by:
| 20 | ||||||||||||||||||||||||
141 | wasCanceled = true; // the grab was stolen by something else | - | ||||||||||||||||||||||||
142 | Q_FALLTHROUGH(); | - | ||||||||||||||||||||||||
143 | 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 | ||||||||||||||||||||||||
144 | case QQuickEventPoint::UngrabExclusive: executed 116 times by 4 tests: case QQuickEventPoint::UngrabExclusive: Executed by:
| 116 | ||||||||||||||||||||||||
145 | setActive(false); | - | ||||||||||||||||||||||||
146 | point->setAccepted(false); | - | ||||||||||||||||||||||||
147 | if (auto par = parentItem()) {
| 0-162 | ||||||||||||||||||||||||
148 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
149 | par->setKeepMouseGrab(d->hadKeepMouseGrab); | - | ||||||||||||||||||||||||
150 | par->setKeepTouchGrab(d->hadKeepTouchGrab); | - | ||||||||||||||||||||||||
151 | } executed 162 times by 4 tests: end of block Executed by:
| 162 | ||||||||||||||||||||||||
152 | break; executed 162 times by 4 tests: break; Executed by:
| 162 | ||||||||||||||||||||||||
153 | case QQuickEventPoint::OverrideGrabPassive: executed 6 times by 1 test: case QQuickEventPoint::OverrideGrabPassive: Executed by:
| 6 | ||||||||||||||||||||||||
154 | // Passive grab is still there, but we won't receive point updates right now. | - | ||||||||||||||||||||||||
155 | // No need to notify about this. | - | ||||||||||||||||||||||||
156 | return; executed 6 times by 1 test: return; Executed by:
| 6 | ||||||||||||||||||||||||
157 | } | - | ||||||||||||||||||||||||
158 | if (wasCanceled)
| 46-434 | ||||||||||||||||||||||||
159 | emit canceled(point); executed 46 times by 3 tests: canceled(point); Executed by:
| 46 | ||||||||||||||||||||||||
160 | emit grabChanged(stateChange, point); | - | ||||||||||||||||||||||||
161 | } executed 480 times by 4 tests: end of block Executed by:
| 480 | ||||||||||||||||||||||||
162 | } executed 482 times by 4 tests: end of block Executed by:
| 482 | ||||||||||||||||||||||||
163 | - | |||||||||||||||||||||||||
164 | /*! | - | ||||||||||||||||||||||||
165 | Acquire or give up a passive grab of the given \a point, according to the \a grab state. | - | ||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||
167 | Unlike the exclusive grab, multiple PointerHandlers can have passive grabs | - | ||||||||||||||||||||||||
168 | simultaneously. This means that each of them will receive further events | - | ||||||||||||||||||||||||
169 | when the \a point moves, and when it is finally released. Typically a | - | ||||||||||||||||||||||||
170 | PointerHandler should acquire a passive grab as soon as a point is pressed, | - | ||||||||||||||||||||||||
171 | if the handler's constraints do not clearly rule out any interest in that | - | ||||||||||||||||||||||||
172 | point. For example, DragHandler needs a passive grab in order to watch the | - | ||||||||||||||||||||||||
173 | movement of a point to see whether it will be dragged past the drag | - | ||||||||||||||||||||||||
174 | threshold. When a handler is actively manipulating its \l target (that is, | - | ||||||||||||||||||||||||
175 | when \l active is true), it may be able to do its work with only a passive | - | ||||||||||||||||||||||||
176 | grab, or it may acquire an exclusive grab if the gesture clearly must not | - | ||||||||||||||||||||||||
177 | be interpreted in another way by another handler. | - | ||||||||||||||||||||||||
178 | */ | - | ||||||||||||||||||||||||
179 | void QQuickPointerHandler::setPassiveGrab(QQuickEventPoint *point, bool grab) | - | ||||||||||||||||||||||||
180 | { | - | ||||||||||||||||||||||||
181 | qCDebug(lcPointerHandlerGrab) << point << grab; never executed: QMessageLogger(__FILE__, 181, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point << grab;
| 0-182 | ||||||||||||||||||||||||
182 | if (grab) {
| 0-182 | ||||||||||||||||||||||||
183 | point->setGrabberPointerHandler(this, false); | - | ||||||||||||||||||||||||
184 | } else { executed 182 times by 4 tests: end of block Executed by:
| 182 | ||||||||||||||||||||||||
185 | point->removePassiveGrabber(this); | - | ||||||||||||||||||||||||
186 | } never executed: end of block | 0 | ||||||||||||||||||||||||
187 | } | - | ||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||
189 | /*! | - | ||||||||||||||||||||||||
190 | Check whether it's OK to take an exclusive grab of the \a point. | - | ||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||
192 | The default implementation will call approveGrabTransition() to check this | - | ||||||||||||||||||||||||
193 | handler's \l grabPermissions. If grabbing can be done only by taking over | - | ||||||||||||||||||||||||
194 | the exclusive grab from an Item, approveGrabTransition() checks the Item's | - | ||||||||||||||||||||||||
195 | \l keepMouseGrab or \l keepTouchGrab flags appropriately. If grabbing can | - | ||||||||||||||||||||||||
196 | be done only by taking over another handler's exclusive grab, canGrab() | - | ||||||||||||||||||||||||
197 | also calls approveGrabTransition() on the handler which is about to lose | - | ||||||||||||||||||||||||
198 | its grab. Either one can deny the takeover. | - | ||||||||||||||||||||||||
199 | */ | - | ||||||||||||||||||||||||
200 | bool QQuickPointerHandler::canGrab(QQuickEventPoint *point) | - | ||||||||||||||||||||||||
201 | { | - | ||||||||||||||||||||||||
202 | QQuickPointerHandler *existingPhGrabber = point->grabberPointerHandler(); | - | ||||||||||||||||||||||||
203 | return approveGrabTransition(point, this) && executed 156 times by 5 tests: return approveGrabTransition(point, this) && (existingPhGrabber ? existingPhGrabber->approveGrabTransition(point, this) : true); Executed by:
| 156 | ||||||||||||||||||||||||
204 | (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 | ||||||||||||||||||||||||
205 | } | - | ||||||||||||||||||||||||
206 | - | |||||||||||||||||||||||||
207 | /*! | - | ||||||||||||||||||||||||
208 | Check this handler's rules to see if \l proposedGrabber will be allowed to take | - | ||||||||||||||||||||||||
209 | the exclusive grab. This function may be called twice: once on the instance which | - | ||||||||||||||||||||||||
210 | will take the grab, and once on the instance which would thereby lose its grab, | - | ||||||||||||||||||||||||
211 | in case of a takeover scenario. | - | ||||||||||||||||||||||||
212 | */ | - | ||||||||||||||||||||||||
213 | bool QQuickPointerHandler::approveGrabTransition(QQuickEventPoint *point, QObject *proposedGrabber) | - | ||||||||||||||||||||||||
214 | { | - | ||||||||||||||||||||||||
215 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
216 | bool allowed = false; | - | ||||||||||||||||||||||||
217 | if (proposedGrabber == this) {
| 12-156 | ||||||||||||||||||||||||
218 | QObject* existingGrabber = point->exclusiveGrabber(); | - | ||||||||||||||||||||||||
219 | allowed = (existingGrabber == nullptr) || ((d->grabPermissions & CanTakeOverFromAnything) == CanTakeOverFromAnything);
| 0-142 | ||||||||||||||||||||||||
220 | if (existingGrabber) {
| 14-142 | ||||||||||||||||||||||||
221 | if (QQuickPointerHandler *existingPhGrabber = point->grabberPointerHandler()) {
| 0-14 | ||||||||||||||||||||||||
222 | if (!allowed && (d->grabPermissions & CanTakeOverFromHandlersOfDifferentType) &&
| 0 | ||||||||||||||||||||||||
223 | existingPhGrabber->metaObject()->className() != metaObject()->className())
| 0 | ||||||||||||||||||||||||
224 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
225 | if (!allowed && (d->grabPermissions & CanTakeOverFromHandlersOfSameType) &&
| 0 | ||||||||||||||||||||||||
226 | existingPhGrabber->metaObject()->className() == metaObject()->className())
| 0 | ||||||||||||||||||||||||
227 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
228 | } else if ((d->grabPermissions & CanTakeOverFromItems)) { never executed: end of block
| 0-14 | ||||||||||||||||||||||||
229 | QQuickItem * existingItemGrabber = point->grabberItem(); | - | ||||||||||||||||||||||||
230 | if (existingItemGrabber && !((existingItemGrabber->keepMouseGrab() && point->pointerEvent()->asPointerMouseEvent()) ||
| 0-14 | ||||||||||||||||||||||||
231 | (existingItemGrabber->keepTouchGrab() && point->pointerEvent()->asPointerTouchEvent())))
| 0-14 | ||||||||||||||||||||||||
232 | allowed = true; executed 14 times by 1 test: allowed = true; Executed by:
| 14 | ||||||||||||||||||||||||
233 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||
234 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||
235 | } else { executed 156 times by 5 tests: end of block Executed by:
| 156 | ||||||||||||||||||||||||
236 | // proposedGrabber is different: that means this instance will lose its grab | - | ||||||||||||||||||||||||
237 | if (proposedGrabber) {
| 4-8 | ||||||||||||||||||||||||
238 | if ((d->grabPermissions & ApprovesTakeOverByAnything) == ApprovesTakeOverByAnything)
| 0-8 | ||||||||||||||||||||||||
239 | allowed = true; executed 8 times by 1 test: allowed = true; Executed by:
| 8 | ||||||||||||||||||||||||
240 | if (!allowed && (d->grabPermissions & ApprovesTakeOverByHandlersOfDifferentType) &&
| 0-8 | ||||||||||||||||||||||||
241 | proposedGrabber->metaObject()->className() != metaObject()->className())
| 0 | ||||||||||||||||||||||||
242 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
243 | if (!allowed && (d->grabPermissions & ApprovesTakeOverByHandlersOfSameType) &&
| 0-8 | ||||||||||||||||||||||||
244 | proposedGrabber->metaObject()->className() == metaObject()->className())
| 0 | ||||||||||||||||||||||||
245 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
246 | if (!allowed && (d->grabPermissions & ApprovesTakeOverByItems) && proposedGrabber->inherits("QQuickItem"))
| 0-8 | ||||||||||||||||||||||||
247 | allowed = true; never executed: allowed = true; | 0 | ||||||||||||||||||||||||
248 | } else { executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
249 | if (!allowed && (d->grabPermissions & ApprovesCancellation))
| 0-4 | ||||||||||||||||||||||||
250 | allowed = true; executed 4 times by 2 tests: allowed = true; Executed by:
| 4 | ||||||||||||||||||||||||
251 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||||||||
252 | } | - | ||||||||||||||||||||||||
253 | qCDebug(lcPointerHandlerGrab) << "point" << hex << point->pointId() << "permission" << 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 | ||||||||||||||||||||||||
254 | 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 | ||||||||||||||||||||||||
255 | ':' << 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 | ||||||||||||||||||||||||
256 | return allowed; executed 168 times by 5 tests: return allowed; Executed by:
| 168 | ||||||||||||||||||||||||
257 | } | - | ||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | /*! | - | ||||||||||||||||||||||||
260 | \qmlproperty bool QtQuick::PointerHandler::grabPermission | - | ||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | This property specifies the permissions when this handler's logic decides | - | ||||||||||||||||||||||||
263 | to take over the exclusive grab, or when it is asked to approve grab | - | ||||||||||||||||||||||||
264 | takeover or cancellation by another handler. | - | ||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | The default is | - | ||||||||||||||||||||||||
267 | \c {CanTakeOverFromItems | CanTakeOverFromHandlersOfDifferentType | ApprovesTakeOverByAnything} | - | ||||||||||||||||||||||||
268 | which allows most takeover scenarios but avoids e.g. two PinchHandlers fighting | - | ||||||||||||||||||||||||
269 | over the same touchpoints. | - | ||||||||||||||||||||||||
270 | */ | - | ||||||||||||||||||||||||
271 | QQuickPointerHandler::GrabPermissions QQuickPointerHandler::grabPermissions() const | - | ||||||||||||||||||||||||
272 | { | - | ||||||||||||||||||||||||
273 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
274 | return static_cast<QQuickPointerHandler::GrabPermissions>(d->grabPermissions); never executed: return static_cast<QQuickPointerHandler::GrabPermissions>(d->grabPermissions); | 0 | ||||||||||||||||||||||||
275 | } | - | ||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | void QQuickPointerHandler::setGrabPermissions(GrabPermissions grabPermission) | - | ||||||||||||||||||||||||
278 | { | - | ||||||||||||||||||||||||
279 | Q_D(QQuickPointerHandler); | - | ||||||||||||||||||||||||
280 | if (d->grabPermissions == grabPermission)
| 0 | ||||||||||||||||||||||||
281 | return; never executed: return; | 0 | ||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||
283 | d->grabPermissions = grabPermission; | - | ||||||||||||||||||||||||
284 | emit grabPermissionChanged(); | - | ||||||||||||||||||||||||
285 | } never executed: end of block | 0 | ||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||
287 | void QQuickPointerHandler::classBegin() | - | ||||||||||||||||||||||||
288 | { | - | ||||||||||||||||||||||||
289 | } | - | ||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | void QQuickPointerHandler::componentComplete() | - | ||||||||||||||||||||||||
292 | { | - | ||||||||||||||||||||||||
293 | } | - | ||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||
295 | QQuickPointerEvent *QQuickPointerHandler::currentEvent() | - | ||||||||||||||||||||||||
296 | { | - | ||||||||||||||||||||||||
297 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
298 | return d->currentEvent; never executed: return d->currentEvent; | 0 | ||||||||||||||||||||||||
299 | } | - | ||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||
301 | /*! | - | ||||||||||||||||||||||||
302 | Acquire or give up the exclusive grab of the given \a point, according to | - | ||||||||||||||||||||||||
303 | the \a grab state, and subject to the rules: canGrab(), and the rule not to | - | ||||||||||||||||||||||||
304 | relinquish another handler's grab. Returns true if permission is granted, | - | ||||||||||||||||||||||||
305 | or if the exclusive grab has already been acquired or relinquished as | - | ||||||||||||||||||||||||
306 | specified. Returns false if permission is denied either by this handler or | - | ||||||||||||||||||||||||
307 | by the handler or item from which this handler would take over | - | ||||||||||||||||||||||||
308 | */ | - | ||||||||||||||||||||||||
309 | bool QQuickPointerHandler::setExclusiveGrab(QQuickEventPoint *point, bool grab) | - | ||||||||||||||||||||||||
310 | { | - | ||||||||||||||||||||||||
311 | if ((grab && point->exclusiveGrabber() == this) || (!grab && point->exclusiveGrabber() != this))
| 16-246 | ||||||||||||||||||||||||
312 | return true; executed 150 times by 5 tests: return true; Executed by:
| 150 | ||||||||||||||||||||||||
313 | // TODO m_hadKeepMouseGrab m_hadKeepTouchGrab | - | ||||||||||||||||||||||||
314 | bool allowed = true; | - | ||||||||||||||||||||||||
315 | if (grab) {
| 112-144 | ||||||||||||||||||||||||
316 | allowed = canGrab(point); | - | ||||||||||||||||||||||||
317 | } else { executed 144 times by 5 tests: end of block Executed by:
| 144 | ||||||||||||||||||||||||
318 | QQuickPointerHandler *existingPhGrabber = point->grabberPointerHandler(); | - | ||||||||||||||||||||||||
319 | // Ask before allowing one handler to cancel another's grab | - | ||||||||||||||||||||||||
320 | if (existingPhGrabber && existingPhGrabber != this && !existingPhGrabber->approveGrabTransition(point, nullptr))
| 0-112 | ||||||||||||||||||||||||
321 | allowed = false; never executed: allowed = false; | 0 | ||||||||||||||||||||||||
322 | } executed 112 times by 4 tests: end of block Executed by:
| 112 | ||||||||||||||||||||||||
323 | qCDebug(lcPointerHandlerGrab) << point << (grab ? "grab" : "ungrab") << (allowed ? "allowed" : "forbidden") << never executed: QMessageLogger(__FILE__, 323, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point << (grab ? "grab" : "ungrab") << (allowed ? "allowed" : "forbidden") << point->exclusiveGrabber() << "->" << (grab ? this : nullptr);
| 0-256 | ||||||||||||||||||||||||
324 | 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 | ||||||||||||||||||||||||
325 | if (allowed)
| 0-256 | ||||||||||||||||||||||||
326 | point->setGrabberPointerHandler(grab ? this : nullptr, true); executed 256 times by 5 tests: point->setGrabberPointerHandler(grab ? this : nullptr, true); Executed by:
| 256 | ||||||||||||||||||||||||
327 | return allowed; executed 256 times by 5 tests: return allowed; Executed by:
| 256 | ||||||||||||||||||||||||
328 | } | - | ||||||||||||||||||||||||
329 | - | |||||||||||||||||||||||||
330 | /*! | - | ||||||||||||||||||||||||
331 | Cancel any existing grab of the given \a point. | - | ||||||||||||||||||||||||
332 | */ | - | ||||||||||||||||||||||||
333 | void QQuickPointerHandler::cancelAllGrabs(QQuickEventPoint *point) | - | ||||||||||||||||||||||||
334 | { | - | ||||||||||||||||||||||||
335 | qCDebug(lcPointerHandlerGrab) << point; never executed: QMessageLogger(__FILE__, 335, __PRETTY_FUNCTION__, lcPointerHandlerGrab().categoryName()).debug() << point;
| 0 | ||||||||||||||||||||||||
336 | point->cancelAllGrabs(this); | - | ||||||||||||||||||||||||
337 | } never executed: end of block | 0 | ||||||||||||||||||||||||
338 | - | |||||||||||||||||||||||||
339 | QPointF QQuickPointerHandler::eventPos(const QQuickEventPoint *point) const | - | ||||||||||||||||||||||||
340 | { | - | ||||||||||||||||||||||||
341 | return (target() ? target()->mapFromScene(point->scenePosition()) : point->scenePosition()); executed 84 times by 1 test: return (target() ? target()->mapFromScene(point->scenePosition()) : point->scenePosition()); Executed by:
| 84 | ||||||||||||||||||||||||
342 | } | - | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | bool QQuickPointerHandler::parentContains(const QQuickEventPoint *point) const | - | ||||||||||||||||||||||||
345 | { | - | ||||||||||||||||||||||||
346 | if (!point)
| 0-6718 | ||||||||||||||||||||||||
347 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
348 | if (QQuickItem *par = parentItem()) {
| 0-6718 | ||||||||||||||||||||||||
349 | if (par->window()) {
| 0-6718 | ||||||||||||||||||||||||
350 | QPoint screenPosition = par->window()->mapToGlobal(point->scenePosition().toPoint()); | - | ||||||||||||||||||||||||
351 | if (!par->window()->geometry().contains(screenPosition))
| 46-6672 | ||||||||||||||||||||||||
352 | return false; executed 46 times by 1 test: return false; Executed by:
| 46 | ||||||||||||||||||||||||
353 | } executed 6672 times by 5 tests: end of block Executed by:
| 6672 | ||||||||||||||||||||||||
354 | QPointF p = par->mapFromScene(point->scenePosition()); | - | ||||||||||||||||||||||||
355 | qreal m = margin(); | - | ||||||||||||||||||||||||
356 | if (m > 0)
| 0-6672 | ||||||||||||||||||||||||
357 | 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 | ||||||||||||||||||||||||
358 | return par->contains(p); executed 6672 times by 5 tests: return par->contains(p); Executed by:
| 6672 | ||||||||||||||||||||||||
359 | } | - | ||||||||||||||||||||||||
360 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
361 | } | - | ||||||||||||||||||||||||
362 | - | |||||||||||||||||||||||||
363 | /*! | - | ||||||||||||||||||||||||
364 | \qmlproperty bool QtQuick::PointerHandler::enabled | - | ||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||
366 | If a PointerHandler is disabled, it will reject all events | - | ||||||||||||||||||||||||
367 | and no signals will be emitted. | - | ||||||||||||||||||||||||
368 | */ | - | ||||||||||||||||||||||||
369 | bool QQuickPointerHandler::enabled() const | - | ||||||||||||||||||||||||
370 | { | - | ||||||||||||||||||||||||
371 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
372 | return d->enabled; executed 68 times by 1 test: return d->enabled; Executed by:
| 68 | ||||||||||||||||||||||||
373 | } | - | ||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||
375 | void QQuickPointerHandler::setEnabled(bool enabled) | - | ||||||||||||||||||||||||
376 | { | - | ||||||||||||||||||||||||
377 | Q_D(QQuickPointerHandler); | - | ||||||||||||||||||||||||
378 | if (d->enabled == enabled)
| 0 | ||||||||||||||||||||||||
379 | return; never executed: return; | 0 | ||||||||||||||||||||||||
380 | - | |||||||||||||||||||||||||
381 | d->enabled = enabled; | - | ||||||||||||||||||||||||
382 | emit enabledChanged(); | - | ||||||||||||||||||||||||
383 | } never executed: end of block | 0 | ||||||||||||||||||||||||
384 | - | |||||||||||||||||||||||||
385 | bool QQuickPointerHandler::active() const | - | ||||||||||||||||||||||||
386 | { | - | ||||||||||||||||||||||||
387 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
388 | return d->active; executed 1135 times by 3 tests: return d->active; Executed by:
| 1135 | ||||||||||||||||||||||||
389 | } | - | ||||||||||||||||||||||||
390 | - | |||||||||||||||||||||||||
391 | /*! | - | ||||||||||||||||||||||||
392 | \qmlproperty Item QtQuick::PointerHandler::target | - | ||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||
394 | The Item which this handler will manipulate. | - | ||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||
396 | By default, it is the same as the \l [QML] {parent}, the Item within which | - | ||||||||||||||||||||||||
397 | the handler is declared. However, it can sometimes be useful to set the | - | ||||||||||||||||||||||||
398 | target to a different Item, in order to handle events within one item | - | ||||||||||||||||||||||||
399 | but manipulate another; or to \c null, to disable the default behavior | - | ||||||||||||||||||||||||
400 | and do something else instead. | - | ||||||||||||||||||||||||
401 | */ | - | ||||||||||||||||||||||||
402 | void QQuickPointerHandler::setTarget(QQuickItem *target) | - | ||||||||||||||||||||||||
403 | { | - | ||||||||||||||||||||||||
404 | Q_D(QQuickPointerHandler); | - | ||||||||||||||||||||||||
405 | d->targetExplicitlySet = true; | - | ||||||||||||||||||||||||
406 | if (d->target == target)
| 0-80 | ||||||||||||||||||||||||
407 | return; never executed: return; | 0 | ||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||
409 | QQuickItem *oldTarget = d->target; | - | ||||||||||||||||||||||||
410 | d->target = target; | - | ||||||||||||||||||||||||
411 | onTargetChanged(oldTarget); | - | ||||||||||||||||||||||||
412 | emit targetChanged(); | - | ||||||||||||||||||||||||
413 | } executed 80 times by 2 tests: end of block Executed by:
| 80 | ||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||
415 | QQuickItem *QQuickPointerHandler::parentItem() const | - | ||||||||||||||||||||||||
416 | { | - | ||||||||||||||||||||||||
417 | return static_cast<QQuickItem *>(QObject::parent()); executed 14311 times by 6 tests: return static_cast<QQuickItem *>(QObject::parent()); Executed by:
| 14311 | ||||||||||||||||||||||||
418 | } | - | ||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||
420 | QQuickItem *QQuickPointerHandler::target() const | - | ||||||||||||||||||||||||
421 | { | - | ||||||||||||||||||||||||
422 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
423 | if (!d->targetExplicitlySet)
| 2066-2480 | ||||||||||||||||||||||||
424 | return parentItem(); executed 2480 times by 3 tests: return parentItem(); Executed by:
| 2480 | ||||||||||||||||||||||||
425 | return d->target; executed 2066 times by 2 tests: return d->target; Executed by:
| 2066 | ||||||||||||||||||||||||
426 | } | - | ||||||||||||||||||||||||
427 | - | |||||||||||||||||||||||||
428 | void QQuickPointerHandler::handlePointerEvent(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
429 | { | - | ||||||||||||||||||||||||
430 | bool wants = wantsPointerEvent(event); | - | ||||||||||||||||||||||||
431 | qCDebug(lcPointerHandlerDispatch) << metaObject()->className() << 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-2756 | ||||||||||||||||||||||||
432 | << "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 | ||||||||||||||||||||||||
433 | << (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 | ||||||||||||||||||||||||
434 | if (wants) {
| 945-1811 | ||||||||||||||||||||||||
435 | handlePointerEventImpl(event); | - | ||||||||||||||||||||||||
436 | } else { executed 1811 times by 5 tests: end of block Executed by:
| 1811 | ||||||||||||||||||||||||
437 | setActive(false); | - | ||||||||||||||||||||||||
438 | int pCount = event->pointCount(); | - | ||||||||||||||||||||||||
439 | for (int i = 0; i < pCount; ++i) {
| 945-1791 | ||||||||||||||||||||||||
440 | QQuickEventPoint *pt = event->point(i); | - | ||||||||||||||||||||||||
441 | if (pt->grabberPointerHandler() == this && pt->state() != QQuickEventPoint::Stationary)
| 12-1747 | ||||||||||||||||||||||||
442 | pt->cancelExclusiveGrab(); executed 12 times by 1 test: pt->cancelExclusiveGrab(); Executed by:
| 12 | ||||||||||||||||||||||||
443 | } executed 1791 times by 4 tests: end of block Executed by:
| 1791 | ||||||||||||||||||||||||
444 | } executed 945 times by 4 tests: end of block Executed by:
| 945 | ||||||||||||||||||||||||
445 | event->device()->eventDeliveryTargets().append(this); | - | ||||||||||||||||||||||||
446 | } executed 2756 times by 5 tests: end of block Executed by:
| 2756 | ||||||||||||||||||||||||
447 | - | |||||||||||||||||||||||||
448 | bool QQuickPointerHandler::wantsPointerEvent(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
449 | { | - | ||||||||||||||||||||||||
450 | Q_D(const QQuickPointerHandler); | - | ||||||||||||||||||||||||
451 | Q_UNUSED(event) | - | ||||||||||||||||||||||||
452 | return d->enabled; executed 2756 times by 5 tests: return d->enabled; Executed by:
| 2756 | ||||||||||||||||||||||||
453 | } | - | ||||||||||||||||||||||||
454 | - | |||||||||||||||||||||||||
455 | bool QQuickPointerHandler::wantsEventPoint(QQuickEventPoint *point) | - | ||||||||||||||||||||||||
456 | { | - | ||||||||||||||||||||||||
457 | bool ret = parentContains(point); | - | ||||||||||||||||||||||||
458 | qCDebug(lcPointerHandlerDispatch) << hex << point->pointId() << "@" << point->scenePosition() never executed: QMessageLogger(__FILE__, 458, __PRETTY_FUNCTION__, lcPointerHandlerDispatch().categoryName()).debug() << hex << point->pointId() << "@" << point->scenePosition() << metaObject()->className() << objectName() << ret;
| 0-3784 | ||||||||||||||||||||||||
459 | << metaObject()->className() << objectName() << ret; never executed: QMessageLogger(__FILE__, 458, __PRETTY_FUNCTION__, lcPointerHandlerDispatch().categoryName()).debug() << hex << point->pointId() << "@" << point->scenePosition() << metaObject()->className() << objectName() << ret; | 0 | ||||||||||||||||||||||||
460 | return ret; executed 3784 times by 4 tests: return ret; Executed by:
| 3784 | ||||||||||||||||||||||||
461 | } | - | ||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||
463 | /*! | - | ||||||||||||||||||||||||
464 | \readonly | - | ||||||||||||||||||||||||
465 | \qmlproperty bool QtQuick::PointerHandler::active | - | ||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | This holds true whenever this PointerHandler has taken sole responsibility | - | ||||||||||||||||||||||||
468 | for handing one or more EventPoints, by successfully taking an exclusive | - | ||||||||||||||||||||||||
469 | grab of those points. This means that it is keeping its properties | - | ||||||||||||||||||||||||
470 | up-to-date according to the movements of those Event Points and actively | - | ||||||||||||||||||||||||
471 | manipulating its \l target (if any). | - | ||||||||||||||||||||||||
472 | */ | - | ||||||||||||||||||||||||
473 | void QQuickPointerHandler::setActive(bool active) | - | ||||||||||||||||||||||||
474 | { | - | ||||||||||||||||||||||||
475 | Q_D(QQuickPointerHandler); | - | ||||||||||||||||||||||||
476 | if (d->active != active) {
| 254-1329 | ||||||||||||||||||||||||
477 | qCDebug(lcPointerHandlerActive) << this << d->active << "->" << active; never executed: QMessageLogger(__FILE__, 477, __PRETTY_FUNCTION__, lcPointerHandlerActive().categoryName()).debug() << this << d->active << "->" << active;
| 0-254 | ||||||||||||||||||||||||
478 | d->active = active; | - | ||||||||||||||||||||||||
479 | onActiveChanged(); | - | ||||||||||||||||||||||||
480 | emit activeChanged(); | - | ||||||||||||||||||||||||
481 | } executed 254 times by 4 tests: end of block Executed by:
| 254 | ||||||||||||||||||||||||
482 | } executed 1583 times by 4 tests: end of block Executed by:
| 1583 | ||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||
484 | void QQuickPointerHandler::handlePointerEventImpl(QQuickPointerEvent *event) | - | ||||||||||||||||||||||||
485 | { | - | ||||||||||||||||||||||||
486 | Q_D(QQuickPointerHandler); | - | ||||||||||||||||||||||||
487 | d->currentEvent = event; | - | ||||||||||||||||||||||||
488 | } executed 1811 times by 5 tests: end of block Executed by:
| 1811 | ||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||
490 | /*! | - | ||||||||||||||||||||||||
491 | \readonly | - | ||||||||||||||||||||||||
492 | \qmlproperty Item QtQuick::PointerHandler::parent | - | ||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||
494 | The \l Item which is the scope of the handler; the Item in which it was declared. | - | ||||||||||||||||||||||||
495 | The handler will handle events on behalf of this Item, which means a | - | ||||||||||||||||||||||||
496 | pointer event is relevant if at least one of its event points occurs within | - | ||||||||||||||||||||||||
497 | the Item's interior. Initially \l [QML] {target} {target()} is the same, but it | - | ||||||||||||||||||||||||
498 | can be reassigned. | - | ||||||||||||||||||||||||
499 | - | |||||||||||||||||||||||||
500 | \sa {target}, QObject::parent() | - | ||||||||||||||||||||||||
501 | */ | - | ||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||
503 | /*! | - | ||||||||||||||||||||||||
504 | \qmlsignal QtQuick::PointerHandler::grabChanged(GrabState stateChange, EventPoint point) | - | ||||||||||||||||||||||||
505 | - | |||||||||||||||||||||||||
506 | This signal is emitted when the grab has changed in some way which is | - | ||||||||||||||||||||||||
507 | relevant to this handler. | - | ||||||||||||||||||||||||
508 | - | |||||||||||||||||||||||||
509 | The \a stateChange (verb) tells what happened. | - | ||||||||||||||||||||||||
510 | The \a point (object) is the point that was grabbed or ungrabbed. | - | ||||||||||||||||||||||||
511 | */ | - | ||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||
513 | /*! | - | ||||||||||||||||||||||||
514 | \qmlsignal QtQuick::PointerHandler::canceled(EventPoint point) | - | ||||||||||||||||||||||||
515 | - | |||||||||||||||||||||||||
516 | If this handler has already grabbed the given \a point, this signal is | - | ||||||||||||||||||||||||
517 | emitted when the grab is stolen by a different Pointer Handler or Item. | - | ||||||||||||||||||||||||
518 | */ | - | ||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||
520 | QQuickPointerHandlerPrivate::QQuickPointerHandlerPrivate() | - | ||||||||||||||||||||||||
521 | : grabPermissions(QQuickPointerHandler::CanTakeOverFromItems | | - | ||||||||||||||||||||||||
522 | QQuickPointerHandler::CanTakeOverFromHandlersOfDifferentType | | - | ||||||||||||||||||||||||
523 | QQuickPointerHandler::ApprovesTakeOverByAnything) | - | ||||||||||||||||||||||||
524 | , enabled(true) | - | ||||||||||||||||||||||||
525 | , active(false) | - | ||||||||||||||||||||||||
526 | , targetExplicitlySet(false) | - | ||||||||||||||||||||||||
527 | , hadKeepMouseGrab(false) | - | ||||||||||||||||||||||||
528 | , hadKeepTouchGrab(false) | - | ||||||||||||||||||||||||
529 | { | - | ||||||||||||||||||||||||
530 | } executed 1016 times by 6 tests: end of block Executed by:
| 1016 | ||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||
532 | QQuickPointerHandlerPrivate::~QQuickPointerHandlerPrivate() | - | ||||||||||||||||||||||||
533 | { | - | ||||||||||||||||||||||||
534 | } | - | ||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||
536 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
Source code | Switch to Preprocessed file |