util/qflickgesture.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui 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 Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qgesture.h" -
43#include "qapplication.h" -
44#include "qevent.h" -
45#include "qwidget.h" -
46#include "qgraphicsitem.h" -
47#include "qgraphicsscene.h" -
48#include "qgraphicssceneevent.h" -
49#include "qgraphicsview.h" -
50#include "qscroller.h" -
51#include "private/qevent_p.h" -
52#include "private/qflickgesture_p.h" -
53#include "qdebug.h" -
54 -
55#ifndef QT_NO_GESTURES -
56 -
57QT_BEGIN_NAMESPACE -
58 -
59//#define QFLICKGESTURE_DEBUG -
60 -
61#ifdef QFLICKGESTURE_DEBUG -
62# define qFGDebug qDebug -
63#else -
64# define qFGDebug while (false) qDebug -
65#endif -
66 -
67extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); -
68 -
69static QMouseEvent *copyMouseEvent(QEvent *e) -
70{ -
71 switch (e->type()) { -
72 case QEvent::MouseButtonPress: -
73 case QEvent::MouseButtonRelease: -
74 case QEvent::MouseMove: { -
75 QMouseEvent *me = static_cast<QMouseEvent *>(e);
never executed (the execution status of this line is deduced): QMouseEvent *me = static_cast<QMouseEvent *>(e);
-
76 return new QMouseEvent(me->type(), QPoint(0, 0), me->windowPos(), me->screenPos(), me->button(), me->buttons(), me->modifiers());
never executed: return new QMouseEvent(me->type(), QPoint(0, 0), me->windowPos(), me->screenPos(), me->button(), me->buttons(), me->modifiers());
0
77 } -
78#ifndef QT_NO_GRAPHICSVIEW -
79 case QEvent::GraphicsSceneMousePress: -
80 case QEvent::GraphicsSceneMouseRelease: -
81 case QEvent::GraphicsSceneMouseMove: { -
82 QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(e);
-
83#if 1 -
84 QEvent::Type met = me->type() == QEvent::GraphicsSceneMousePress ? QEvent::MouseButtonPress :
never evaluated: me->type() == QEvent::GraphicsSceneMousePress
0
85 (me->type() == QEvent::GraphicsSceneMouseRelease ? QEvent::MouseButtonRelease : QEvent::MouseMove);
never executed (the execution status of this line is deduced): (me->type() == QEvent::GraphicsSceneMouseRelease ? QEvent::MouseButtonRelease : QEvent::MouseMove);
-
86 return new QMouseEvent(met, QPoint(0, 0), QPoint(0, 0), me->screenPos(), me->button(), me->buttons(), me->modifiers());
never executed: return new QMouseEvent(met, QPoint(0, 0), QPoint(0, 0), me->screenPos(), me->button(), me->buttons(), me->modifiers());
0
87#else -
88 QGraphicsSceneMouseEvent *copy = new QGraphicsSceneMouseEvent(me->type()); -
89 copy->setPos(me->pos()); -
90 copy->setScenePos(me->scenePos()); -
91 copy->setScreenPos(me->screenPos()); -
92 for (int i = 0x1; i <= 0x10; i <<= 1) { -
93 Qt::MouseButton button = Qt::MouseButton(i); -
94 copy->setButtonDownPos(button, me->buttonDownPos(button)); -
95 copy->setButtonDownScenePos(button, me->buttonDownScenePos(button)); -
96 copy->setButtonDownScreenPos(button, me->buttonDownScreenPos(button)); -
97 } -
98 copy->setLastPos(me->lastPos()); -
99 copy->setLastScenePos(me->lastScenePos()); -
100 copy->setLastScreenPos(me->lastScreenPos()); -
101 copy->setButtons(me->buttons()); -
102 copy->setButton(me->button()); -
103 copy->setModifiers(me->modifiers()); -
104 return copy; -
105#endif -
106 } -
107#endif // QT_NO_GRAPHICSVIEW -
108 default: -
109 return 0;
never executed: return 0;
0
110 } -
111}
never executed: }
0
112 -
113class PressDelayHandler : public QObject -
114{ -
115private: -
116 PressDelayHandler(QObject *parent = 0) -
117 : QObject(parent) -
118 , pressDelayTimer(0) -
119 , sendingEvent(false) -
120 , mouseButton(Qt::NoButton) -
121 , mouseTarget(0) -
122 { }
executed: }
Execution Count:1
1
123 -
124 static PressDelayHandler *inst; -
125 -
126public: -
127 enum { -
128 UngrabMouseBefore = 1, -
129 RegrabMouseAfterwards = 2 -
130 }; -
131 -
132 static PressDelayHandler *instance() -
133 { -
134 static PressDelayHandler *inst = 0; -
135 if (!inst)
evaluated: !inst
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:175
1-175
136 inst = new PressDelayHandler(QCoreApplication::instance());
executed: inst = new PressDelayHandler(QCoreApplication::instance());
Execution Count:1
1
137 return inst;
executed: return inst;
Execution Count:176
176
138 } -
139 -
140 bool shouldEventBeIgnored(QEvent *) const -
141 { -
142 return sendingEvent;
executed: return sendingEvent;
Execution Count:176
176
143 } -
144 -
145 bool isDelaying() const -
146 { -
147 return !pressDelayEvent.isNull();
never executed: return !pressDelayEvent.isNull();
0
148 } -
149 -
150 void pressed(QEvent *e, int delay) -
151 { -
152 if (!pressDelayEvent) {
never evaluated: !pressDelayEvent
0
153 pressDelayEvent.reset(copyMouseEvent(e));
never executed (the execution status of this line is deduced): pressDelayEvent.reset(copyMouseEvent(e));
-
154 pressDelayTimer = startTimer(delay);
never executed (the execution status of this line is deduced): pressDelayTimer = startTimer(delay);
-
155 mouseTarget = QApplication::widgetAt(pressDelayEvent->globalPos());
never executed (the execution status of this line is deduced): mouseTarget = QApplication::widgetAt(pressDelayEvent->globalPos());
-
156 mouseButton = pressDelayEvent->button();
never executed (the execution status of this line is deduced): mouseButton = pressDelayEvent->button();
-
157 qFGDebug() << "QFG: consuming/delaying mouse press";
never executed: QMessageLogger("util/qflickgesture.cpp", 157, __PRETTY_FUNCTION__).debug() << "QFG: consuming/delaying mouse press";
never evaluated: false
0
158 } else {
never executed: }
0
159 qFGDebug() << "QFG: NOT consuming/delaying mouse press";
never executed: QMessageLogger("util/qflickgesture.cpp", 159, __PRETTY_FUNCTION__).debug() << "QFG: NOT consuming/delaying mouse press";
never evaluated: false
0
160 }
never executed: }
0
161 e->setAccepted(true);
never executed (the execution status of this line is deduced): e->setAccepted(true);
-
162 }
never executed: }
0
163 -
164 bool released(QEvent *e, bool scrollerWasActive, bool scrollerIsActive) -
165 { -
166 // consume this event if the scroller was or is active -
167 bool result = scrollerWasActive || scrollerIsActive;
never evaluated: scrollerWasActive
never evaluated: scrollerIsActive
0
168 -
169 // stop the timer -
170 if (pressDelayTimer) {
never evaluated: pressDelayTimer
0
171 killTimer(pressDelayTimer);
never executed (the execution status of this line is deduced): killTimer(pressDelayTimer);
-
172 pressDelayTimer = 0;
never executed (the execution status of this line is deduced): pressDelayTimer = 0;
-
173 }
never executed: }
0
174 // we still haven't even sent the press, so do it now -
175 if (pressDelayEvent && mouseTarget && !scrollerIsActive) {
never evaluated: pressDelayEvent
never evaluated: mouseTarget
never evaluated: !scrollerIsActive
0
176 QScopedPointer<QMouseEvent> releaseEvent(copyMouseEvent(e));
never executed (the execution status of this line is deduced): QScopedPointer<QMouseEvent> releaseEvent(copyMouseEvent(e));
-
177 -
178 qFGDebug() << "QFG: re-sending mouse press (due to release) for " << mouseTarget;
never executed: QMessageLogger("util/qflickgesture.cpp", 178, __PRETTY_FUNCTION__).debug() << "QFG: re-sending mouse press (due to release) for " << mouseTarget;
never evaluated: false
0
179 sendMouseEvent(pressDelayEvent.data(), UngrabMouseBefore);
never executed (the execution status of this line is deduced): sendMouseEvent(pressDelayEvent.data(), UngrabMouseBefore);
-
180 -
181 qFGDebug() << "QFG: faking mouse release (due to release) for " << mouseTarget;
never executed: QMessageLogger("util/qflickgesture.cpp", 181, __PRETTY_FUNCTION__).debug() << "QFG: faking mouse release (due to release) for " << mouseTarget;
never evaluated: false
0
182 sendMouseEvent(releaseEvent.data());
never executed (the execution status of this line is deduced): sendMouseEvent(releaseEvent.data());
-
183 -
184 result = true; // consume this event
never executed (the execution status of this line is deduced): result = true;
-
185 } else if (mouseTarget && scrollerIsActive) {
never executed: }
never evaluated: mouseTarget
never evaluated: scrollerIsActive
0
186 // we grabbed the mouse expicitly when the scroller became active, so undo that now -
187 sendMouseEvent(0, UngrabMouseBefore);
never executed (the execution status of this line is deduced): sendMouseEvent(0, UngrabMouseBefore);
-
188 }
never executed: }
0
189 pressDelayEvent.reset(0);
never executed (the execution status of this line is deduced): pressDelayEvent.reset(0);
-
190 mouseTarget = 0;
never executed (the execution status of this line is deduced): mouseTarget = 0;
-
191 return result;
never executed: return result;
0
192 } -
193 -
194 void scrollerWasIntercepted() -
195 { -
196 qFGDebug() << "QFG: deleting delayed mouse press, since scroller was only intercepted";
never executed: QMessageLogger("util/qflickgesture.cpp", 196, __PRETTY_FUNCTION__).debug() << "QFG: deleting delayed mouse press, since scroller was only intercepted";
never evaluated: false
0
197 if (pressDelayEvent) {
never evaluated: pressDelayEvent
0
198 // we still haven't even sent the press, so just throw it away now -
199 if (pressDelayTimer) {
never evaluated: pressDelayTimer
0
200 killTimer(pressDelayTimer);
never executed (the execution status of this line is deduced): killTimer(pressDelayTimer);
-
201 pressDelayTimer = 0;
never executed (the execution status of this line is deduced): pressDelayTimer = 0;
-
202 }
never executed: }
0
203 pressDelayEvent.reset(0);
never executed (the execution status of this line is deduced): pressDelayEvent.reset(0);
-
204 }
never executed: }
0
205 mouseTarget = 0;
never executed (the execution status of this line is deduced): mouseTarget = 0;
-
206 }
never executed: }
0
207 -
208 void scrollerBecameActive() -
209 { -
210 if (pressDelayEvent) {
never evaluated: pressDelayEvent
0
211 // we still haven't even sent the press, so just throw it away now -
212 qFGDebug() << "QFG: deleting delayed mouse press, since scroller is active now";
never executed: QMessageLogger("util/qflickgesture.cpp", 212, __PRETTY_FUNCTION__).debug() << "QFG: deleting delayed mouse press, since scroller is active now";
never evaluated: false
0
213 if (pressDelayTimer) {
never evaluated: pressDelayTimer
0
214 killTimer(pressDelayTimer);
never executed (the execution status of this line is deduced): killTimer(pressDelayTimer);
-
215 pressDelayTimer = 0;
never executed (the execution status of this line is deduced): pressDelayTimer = 0;
-
216 }
never executed: }
0
217 pressDelayEvent.reset(0);
never executed (the execution status of this line is deduced): pressDelayEvent.reset(0);
-
218 mouseTarget = 0;
never executed (the execution status of this line is deduced): mouseTarget = 0;
-
219 } else if (mouseTarget) {
never executed: }
never evaluated: mouseTarget
0
220 // we did send a press, so we need to fake a release now -
221 -
222 // release all pressed mouse buttons -
223 /* Qt::MouseButtons mouseButtons = QApplication::mouseButtons(); -
224 for (int i = 0; i < 32; ++i) { -
225 if (mouseButtons & (1 << i)) { -
226 Qt::MouseButton b = static_cast<Qt::MouseButton>(1 << i); -
227 mouseButtons &= ~b; -
228 QPoint farFarAway(-QWIDGETSIZE_MAX, -QWIDGETSIZE_MAX); -
229 -
230 qFGDebug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget; -
231 QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, -
232 b, mouseButtons, QApplication::keyboardModifiers()); -
233 sendMouseEvent(&re); -
234 } -
235 }*/ -
236 -
237 QPoint farFarAway(-QWIDGETSIZE_MAX, -QWIDGETSIZE_MAX);
never executed (the execution status of this line is deduced): QPoint farFarAway(-((1<<24)-1), -((1<<24)-1));
-
238 -
239 qFGDebug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget;
never executed: QMessageLogger("util/qflickgesture.cpp", 239, __PRETTY_FUNCTION__).debug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget;
never evaluated: false
0
240 QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, farFarAway,
never executed (the execution status of this line is deduced): QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, farFarAway,
-
241 mouseButton, QApplication::mouseButtons() & ~mouseButton,
never executed (the execution status of this line is deduced): mouseButton, QApplication::mouseButtons() & ~mouseButton,
-
242 QApplication::keyboardModifiers());
never executed (the execution status of this line is deduced): QApplication::keyboardModifiers());
-
243 sendMouseEvent(&re, RegrabMouseAfterwards);
never executed (the execution status of this line is deduced): sendMouseEvent(&re, RegrabMouseAfterwards);
-
244 // don't clear the mouseTarget just yet, since we need to explicitly ungrab the mouse on release! -
245 }
never executed: }
0
246 } -
247 -
248protected: -
249 void timerEvent(QTimerEvent *e) -
250 { -
251 if (e->timerId() == pressDelayTimer) {
never evaluated: e->timerId() == pressDelayTimer
0
252 if (pressDelayEvent && mouseTarget) {
never evaluated: pressDelayEvent
never evaluated: mouseTarget
0
253 qFGDebug() << "QFG: timer event: re-sending mouse press to " << mouseTarget;
never executed: QMessageLogger("util/qflickgesture.cpp", 253, __PRETTY_FUNCTION__).debug() << "QFG: timer event: re-sending mouse press to " << mouseTarget;
never evaluated: false
0
254 sendMouseEvent(pressDelayEvent.data(), UngrabMouseBefore);
never executed (the execution status of this line is deduced): sendMouseEvent(pressDelayEvent.data(), UngrabMouseBefore);
-
255 }
never executed: }
0
256 pressDelayEvent.reset(0);
never executed (the execution status of this line is deduced): pressDelayEvent.reset(0);
-
257 -
258 if (pressDelayTimer) {
never evaluated: pressDelayTimer
0
259 killTimer(pressDelayTimer);
never executed (the execution status of this line is deduced): killTimer(pressDelayTimer);
-
260 pressDelayTimer = 0;
never executed (the execution status of this line is deduced): pressDelayTimer = 0;
-
261 }
never executed: }
0
262 }
never executed: }
0
263 }
never executed: }
0
264 -
265 void sendMouseEvent(QMouseEvent *me, int flags = 0) -
266 { -
267 if (mouseTarget) {
never evaluated: mouseTarget
0
268 sendingEvent = true;
never executed (the execution status of this line is deduced): sendingEvent = true;
-
269 -
270#ifndef QT_NO_GRAPHICSVIEW -
271 QGraphicsItem *grabber = 0;
never executed (the execution status of this line is deduced): QGraphicsItem *grabber = 0;
-
272 if (mouseTarget->parentWidget()) {
never evaluated: mouseTarget->parentWidget()
0
273 if (QGraphicsView *gv = qobject_cast<QGraphicsView *>(mouseTarget->parentWidget())) {
never evaluated: QGraphicsView *gv = qobject_cast<QGraphicsView *>(mouseTarget->parentWidget())
0
274 if (gv->scene())
never evaluated: gv->scene()
0
275 grabber = gv->scene()->mouseGrabberItem();
never executed: grabber = gv->scene()->mouseGrabberItem();
0
276 }
never executed: }
0
277 }
never executed: }
0
278 -
279 if (grabber && (flags & UngrabMouseBefore)) {
never evaluated: grabber
never evaluated: (flags & UngrabMouseBefore)
0
280 // GraphicsView Mouse Handling Workaround #1: -
281 // we need to ungrab the mouse before re-sending the press, -
282 // since the scene had already set the mouse grabber to the -
283 // original (and consumed) event's receiver -
284 qFGDebug() << "QFG: ungrabbing" << grabber;
never executed: QMessageLogger("util/qflickgesture.cpp", 284, __PRETTY_FUNCTION__).debug() << "QFG: ungrabbing" << grabber;
never evaluated: false
0
285 grabber->ungrabMouse();
never executed (the execution status of this line is deduced): grabber->ungrabMouse();
-
286 }
never executed: }
0
287#endif // QT_NO_GRAPHICSVIEW -
288 -
289 if (me) {
never evaluated: me
0
290 QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPos()),
never executed (the execution status of this line is deduced): QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPos()),
-
291 mouseTarget->topLevelWidget()->mapFromGlobal(me->globalPos()), me->screenPos(),
never executed (the execution status of this line is deduced): mouseTarget->topLevelWidget()->mapFromGlobal(me->globalPos()), me->screenPos(),
-
292 me->button(), me->buttons(), me->modifiers());
never executed (the execution status of this line is deduced): me->button(), me->buttons(), me->modifiers());
-
293 qt_sendSpontaneousEvent(mouseTarget, &copy);
never executed (the execution status of this line is deduced): qt_sendSpontaneousEvent(mouseTarget, &copy);
-
294 }
never executed: }
0
295 -
296#ifndef QT_NO_GRAPHICSVIEW -
297 if (grabber && (flags & RegrabMouseAfterwards)) {
never evaluated: grabber
never evaluated: (flags & RegrabMouseAfterwards)
0
298 // GraphicsView Mouse Handling Workaround #2: -
299 // we need to re-grab the mouse after sending a faked mouse -
300 // release, since we still need the mouse moves for the gesture -
301 // (the scene will clear the item's mouse grabber status on -
302 // release). -
303 qFGDebug() << "QFG: re-grabbing" << grabber;
never executed: QMessageLogger("util/qflickgesture.cpp", 303, __PRETTY_FUNCTION__).debug() << "QFG: re-grabbing" << grabber;
never evaluated: false
0
304 grabber->grabMouse();
never executed (the execution status of this line is deduced): grabber->grabMouse();
-
305 }
never executed: }
0
306#endif -
307 sendingEvent = false;
never executed (the execution status of this line is deduced): sendingEvent = false;
-
308 }
never executed: }
0
309 }
never executed: }
0
310 -
311 -
312private: -
313 int pressDelayTimer; -
314 QScopedPointer<QMouseEvent> pressDelayEvent; -
315 bool sendingEvent; -
316 Qt::MouseButton mouseButton; -
317 QPointer<QWidget> mouseTarget; -
318}; -
319 -
320 -
321/*! -
322 \internal -
323 \class QFlickGesture -
324 \since 4.8 -
325 \brief The QFlickGesture class describes a flicking gesture made by the user. -
326 \ingroup gestures -
327 The QFlickGesture is more complex than the QPanGesture that uses QScroller and QScrollerProperties -
328 to decide if it is triggered. -
329 This gesture is reacting on touch event as compared to the QMouseFlickGesture. -
330 -
331 \sa {Gestures in Widgets and Graphics View}, QScroller, QScrollerProperties, QMouseFlickGesture -
332*/ -
333 -
334/*! -
335 \internal -
336*/ -
337QFlickGesture::QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent) -
338 : QGesture(*new QFlickGesturePrivate, parent) -
339{ -
340 d_func()->q_ptr = this;
executed (the execution status of this line is deduced): d_func()->q_ptr = this;
-
341 d_func()->receiver = receiver;
executed (the execution status of this line is deduced): d_func()->receiver = receiver;
-
342 d_func()->receiverScroller = (receiver && QScroller::hasScroller(receiver)) ? QScroller::scroller(receiver) : 0;
evaluated: receiver
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: QScroller::hasScroller(receiver)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
343 d_func()->button = button;
executed (the execution status of this line is deduced): d_func()->button = button;
-
344}
executed: }
Execution Count:4
4
345 -
346QFlickGesture::~QFlickGesture() -
347{ } -
348 -
349QFlickGesturePrivate::QFlickGesturePrivate() -
350 : receiverScroller(0), button(Qt::NoButton), macIgnoreWheel(false) -
351{ }
executed: }
Execution Count:4
4
352 -
353 -
354// -
355// QFlickGestureRecognizer -
356// -
357 -
358 -
359QFlickGestureRecognizer::QFlickGestureRecognizer(Qt::MouseButton button) -
360{ -
361 this->button = button;
executed (the execution status of this line is deduced): this->button = button;
-
362}
executed: }
Execution Count:2
2
363 -
364/*! \reimp -
365 */ -
366QGesture *QFlickGestureRecognizer::create(QObject *target) -
367{ -
368#ifndef QT_NO_GRAPHICSVIEW -
369 QGraphicsObject *go = qobject_cast<QGraphicsObject*>(target);
executed (the execution status of this line is deduced): QGraphicsObject *go = qobject_cast<QGraphicsObject*>(target);
-
370 if (go && button == Qt::NoButton) {
partially evaluated: go
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
never evaluated: button == Qt::NoButton
0-4
371 go->setAcceptTouchEvents(true);
never executed (the execution status of this line is deduced): go->setAcceptTouchEvents(true);
-
372 }
never executed: }
0
373#endif -
374 return new QFlickGesture(target, button);
executed: return new QFlickGesture(target, button);
Execution Count:4
4
375} -
376 -
377/*! \internal -
378 The recognize function detects a touch event suitable to start the attached QScroller. -
379 The QFlickGesture will be triggered as soon as the scroller is no longer in the state -
380 QScroller::Inactive or QScroller::Pressed. It will be finished or canceled -
381 at the next QEvent::TouchEnd. -
382 Note that the QScroller might continue scrolling (kinetically) at this point. -
383 */ -
384QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, -
385 QObject *watched, -
386 QEvent *event) -
387{ -
388 Q_UNUSED(watched);
executed (the execution status of this line is deduced): (void)watched;;
-
389 -
390 static QElapsedTimer monotonicTimer; -
391 if (!monotonicTimer.isValid())
partially evaluated: !monotonicTimer.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:176
0-176
392 monotonicTimer.start();
never executed: monotonicTimer.start();
0
393 -
394 QFlickGesture *q = static_cast<QFlickGesture *>(state);
executed (the execution status of this line is deduced): QFlickGesture *q = static_cast<QFlickGesture *>(state);
-
395 QFlickGesturePrivate *d = q->d_func();
executed (the execution status of this line is deduced): QFlickGesturePrivate *d = q->d_func();
-
396 -
397 QScroller *scroller = d->receiverScroller;
executed (the execution status of this line is deduced): QScroller *scroller = d->receiverScroller;
-
398 if (!scroller)
partially evaluated: !scroller
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:176
0-176
399 return Ignore; // nothing to do without a scroller?
never executed: return Ignore;
0
400 -
401 QWidget *receiverWidget = qobject_cast<QWidget *>(d->receiver);
executed (the execution status of this line is deduced): QWidget *receiverWidget = qobject_cast<QWidget *>(d->receiver);
-
402#ifndef QT_NO_GRAPHICSVIEW -
403 QGraphicsObject *receiverGraphicsObject = qobject_cast<QGraphicsObject *>(d->receiver);
executed (the execution status of this line is deduced): QGraphicsObject *receiverGraphicsObject = qobject_cast<QGraphicsObject *>(d->receiver);
-
404#endif -
405 -
406 // this is only set for events that we inject into the event loop via sendEvent() -
407 if (PressDelayHandler::instance()->shouldEventBeIgnored(event)) {
partially evaluated: PressDelayHandler::instance()->shouldEventBeIgnored(event)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:176
0-176
408 //qFGDebug() << state << "QFG: ignored event: " << event->type(); -
409 return Ignore;
never executed: return Ignore;
0
410 } -
411 -
412 const QMouseEvent *me = 0;
executed (the execution status of this line is deduced): const QMouseEvent *me = 0;
-
413#ifndef QT_NO_GRAPHICSVIEW -
414 const QGraphicsSceneMouseEvent *gsme = 0;
executed (the execution status of this line is deduced): const QGraphicsSceneMouseEvent *gsme = 0;
-
415#endif -
416 const QTouchEvent *te = 0;
executed (the execution status of this line is deduced): const QTouchEvent *te = 0;
-
417 QPoint globalPos;
executed (the execution status of this line is deduced): QPoint globalPos;
-
418 -
419 // qFGDebug() << "FlickGesture "<<state<<"watched:"<<watched<<"receiver"<<d->receiver<<"event"<<event->type()<<"button"<<button; -
420 -
421 switch (event->type()) { -
422 case QEvent::MouseButtonPress: -
423 case QEvent::MouseButtonRelease: -
424 case QEvent::MouseMove: -
425 if (!receiverWidget)
never evaluated: !receiverWidget
0
426 return Ignore;
never executed: return Ignore;
0
427 if (button != Qt::NoButton) {
never evaluated: button != Qt::NoButton
0
428 me = static_cast<const QMouseEvent *>(event);
never executed (the execution status of this line is deduced): me = static_cast<const QMouseEvent *>(event);
-
429 globalPos = me->globalPos();
never executed (the execution status of this line is deduced): globalPos = me->globalPos();
-
430 }
never executed: }
0
431 break;
never executed: break;
0
432#ifndef QT_NO_GRAPHICSVIEW -
433 case QEvent::GraphicsSceneMousePress: -
434 case QEvent::GraphicsSceneMouseRelease: -
435 case QEvent::GraphicsSceneMouseMove: -
436 if (!receiverGraphicsObject)
never evaluated: !receiverGraphicsObject
0
437 return Ignore;
never executed: return Ignore;
0
438 if (button != Qt::NoButton) {
never evaluated: button != Qt::NoButton
0
439 gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
never executed (the execution status of this line is deduced): gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
-
440 globalPos = gsme->screenPos();
never executed (the execution status of this line is deduced): globalPos = gsme->screenPos();
-
441 }
never executed: }
0
442 break;
never executed: break;
0
443#endif -
444 case QEvent::TouchBegin: -
445 case QEvent::TouchEnd: -
446 case QEvent::TouchUpdate: -
447 if (button == Qt::NoButton) {
partially evaluated: button == Qt::NoButton
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
448 te = static_cast<const QTouchEvent *>(event);
executed (the execution status of this line is deduced): te = static_cast<const QTouchEvent *>(event);
-
449 if (!te->touchPoints().isEmpty())
partially evaluated: !te->touchPoints().isEmpty()
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
450 globalPos = te->touchPoints().at(0).screenPos().toPoint();
executed: globalPos = te->touchPoints().at(0).screenPos().toPoint();
Execution Count:21
21
451 }
executed: }
Execution Count:21
21
452 break;
executed: break;
Execution Count:21
21
453 -
454#if defined(Q_WS_MAC) -
455 // the only way to distinguish between real mouse wheels and wheel -
456 // events generated by the native 2 finger swipe gesture is to listen -
457 // for these events (according to Apple's Cocoa Event-Handling Guide) -
458 -
459 case QEvent::NativeGesture: { -
460 QNativeGestureEvent *nge = static_cast<QNativeGestureEvent *>(event); -
461 if (nge->gestureType == QNativeGestureEvent::GestureBegin) -
462 d->macIgnoreWheel = true; -
463 else if (nge->gestureType == QNativeGestureEvent::GestureEnd) -
464 d->macIgnoreWheel = false; -
465 break; -
466 } -
467#endif -
468 -
469 // consume all wheel events if the scroller is active -
470 case QEvent::Wheel: -
471 if (d->macIgnoreWheel || (scroller->state() != QScroller::Inactive))
never evaluated: d->macIgnoreWheel
never evaluated: (scroller->state() != QScroller::Inactive)
0
472 return Ignore | ConsumeEventHint;
never executed: return Ignore | ConsumeEventHint;
0
473 break;
never executed: break;
0
474 -
475 // consume all dbl click events if the scroller is active -
476 case QEvent::MouseButtonDblClick: -
477 if (scroller->state() != QScroller::Inactive)
never evaluated: scroller->state() != QScroller::Inactive
0
478 return Ignore | ConsumeEventHint;
never executed: return Ignore | ConsumeEventHint;
0
479 break;
never executed: break;
0
480 -
481 default: -
482 break;
executed: break;
Execution Count:155
155
483 } -
484 -
485 if (!me
partially evaluated: !me
TRUEFALSE
yes
Evaluation Count:176
no
Evaluation Count:0
0-176
486#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
487 && !gsme
partially evaluated: !gsme
TRUEFALSE
yes
Evaluation Count:176
no
Evaluation Count:0
0-176
488#endif
executed (the execution status of this line is deduced):
-
489 && !te) // Neither mouse nor touch
evaluated: !te
TRUEFALSE
yes
Evaluation Count:155
yes
Evaluation Count:21
21-155
490 return Ignore;
executed: return Ignore;
Execution Count:155
155
491 -
492 // get the current pointer position in local coordinates. -
493 QPointF point;
executed (the execution status of this line is deduced): QPointF point;
-
494 QScroller::Input inputType = (QScroller::Input) 0;
executed (the execution status of this line is deduced): QScroller::Input inputType = (QScroller::Input) 0;
-
495 -
496 switch (event->type()) { -
497 case QEvent::MouseButtonPress: -
498 if (me && me->button() == button && me->buttons() == button) {
never evaluated: me
never evaluated: me->button() == button
never evaluated: me->buttons() == button
0
499 point = me->globalPos();
never executed (the execution status of this line is deduced): point = me->globalPos();
-
500 inputType = QScroller::InputPress;
never executed (the execution status of this line is deduced): inputType = QScroller::InputPress;
-
501 } else if (me) {
never executed: }
never evaluated: me
0
502 scroller->stop();
never executed (the execution status of this line is deduced): scroller->stop();
-
503 return CancelGesture;
never executed: return CancelGesture;
0
504 } -
505 break;
never executed: break;
0
506 case QEvent::MouseButtonRelease: -
507 if (me && me->button() == button) {
never evaluated: me
never evaluated: me->button() == button
0
508 point = me->globalPos();
never executed (the execution status of this line is deduced): point = me->globalPos();
-
509 inputType = QScroller::InputRelease;
never executed (the execution status of this line is deduced): inputType = QScroller::InputRelease;
-
510 }
never executed: }
0
511 break;
never executed: break;
0
512 case QEvent::MouseMove: -
513 if (me && me->buttons() == button) {
never evaluated: me
never evaluated: me->buttons() == button
0
514 point = me->globalPos();
never executed (the execution status of this line is deduced): point = me->globalPos();
-
515 inputType = QScroller::InputMove;
never executed (the execution status of this line is deduced): inputType = QScroller::InputMove;
-
516 }
never executed: }
0
517 break;
never executed: break;
0
518 -
519#ifndef QT_NO_GRAPHICSVIEW -
520 case QEvent::GraphicsSceneMousePress: -
521 if (gsme && gsme->button() == button && gsme->buttons() == button) {
never evaluated: gsme
never evaluated: gsme->button() == button
never evaluated: gsme->buttons() == button
0
522 point = gsme->scenePos();
never executed (the execution status of this line is deduced): point = gsme->scenePos();
-
523 inputType = QScroller::InputPress;
never executed (the execution status of this line is deduced): inputType = QScroller::InputPress;
-
524 } else if (gsme) {
never executed: }
never evaluated: gsme
0
525 scroller->stop();
never executed (the execution status of this line is deduced): scroller->stop();
-
526 return CancelGesture;
never executed: return CancelGesture;
0
527 } -
528 break;
never executed: break;
0
529 case QEvent::GraphicsSceneMouseRelease: -
530 if (gsme && gsme->button() == button) {
never evaluated: gsme
never evaluated: gsme->button() == button
0
531 point = gsme->scenePos();
never executed (the execution status of this line is deduced): point = gsme->scenePos();
-
532 inputType = QScroller::InputRelease;
never executed (the execution status of this line is deduced): inputType = QScroller::InputRelease;
-
533 }
never executed: }
0
534 break;
never executed: break;
0
535 case QEvent::GraphicsSceneMouseMove: -
536 if (gsme && gsme->buttons() == button) {
never evaluated: gsme
never evaluated: gsme->buttons() == button
0
537 point = gsme->scenePos();
never executed (the execution status of this line is deduced): point = gsme->scenePos();
-
538 inputType = QScroller::InputMove;
never executed (the execution status of this line is deduced): inputType = QScroller::InputMove;
-
539 }
never executed: }
0
540 break;
never executed: break;
0
541#endif -
542 -
543 case QEvent::TouchBegin: -
544 inputType = QScroller::InputPress;
executed (the execution status of this line is deduced): inputType = QScroller::InputPress;
-
545 // fall through -
546 case QEvent::TouchEnd:
code before this statement executed: case QEvent::TouchEnd:
Execution Count:7
7
547 if (!inputType)
evaluated: !inputType
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:7
7
548 inputType = QScroller::InputRelease;
executed: inputType = QScroller::InputRelease;
Execution Count:7
7
549 // fallthrough -
550 case QEvent::TouchUpdate:
code before this statement executed: case QEvent::TouchUpdate:
Execution Count:14
14
551 if (!inputType)
evaluated: !inputType
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:14
7-14
552 inputType = QScroller::InputMove;
executed: inputType = QScroller::InputMove;
Execution Count:7
7
553 -
554 if (te->device()->type() == QTouchDevice::TouchPad) {
partially evaluated: te->device()->type() == QTouchDevice::TouchPad
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
555 if (te->touchPoints().count() != 2) // 2 fingers on pad
never evaluated: te->touchPoints().count() != 2
0
556 return Ignore;
never executed: return Ignore;
0
557 -
558 point = te->touchPoints().at(0).startScenePos() +
never executed (the execution status of this line is deduced): point = te->touchPoints().at(0).startScenePos() +
-
559 ((te->touchPoints().at(0).scenePos() - te->touchPoints().at(0).startScenePos()) +
never executed (the execution status of this line is deduced): ((te->touchPoints().at(0).scenePos() - te->touchPoints().at(0).startScenePos()) +
-
560 (te->touchPoints().at(1).scenePos() - te->touchPoints().at(1).startScenePos())) / 2;
never executed (the execution status of this line is deduced): (te->touchPoints().at(1).scenePos() - te->touchPoints().at(1).startScenePos())) / 2;
-
561 } else { // TouchScreen
never executed: }
0
562 if (te->touchPoints().count() != 1) // 1 finger on screen
partially evaluated: te->touchPoints().count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
563 return Ignore;
never executed: return Ignore;
0
564 -
565 point = te->touchPoints().at(0).scenePos();
executed (the execution status of this line is deduced): point = te->touchPoints().at(0).scenePos();
-
566 }
executed: }
Execution Count:21
21
567 break;
executed: break;
Execution Count:21
21
568 -
569 default: -
570 break;
never executed: break;
0
571 } -
572 -
573 // Check for an active scroller at globalPos -
574 if (inputType == QScroller::InputPress) {
evaluated: inputType == QScroller::InputPress
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:14
7-14
575 foreach (QScroller *as, QScroller::activeScrollers()) {
never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(QScroller::activeScrollers())> _container_(QScroller::activeScrollers()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QScroller *as = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
576 if (as != scroller) {
never evaluated: as != scroller
0
577 QRegion scrollerRegion;
never executed (the execution status of this line is deduced): QRegion scrollerRegion;
-
578 -
579 if (QWidget *w = qobject_cast<QWidget *>(as->target())) {
never evaluated: QWidget *w = qobject_cast<QWidget *>(as->target())
0
580 scrollerRegion = QRect(w->mapToGlobal(QPoint(0, 0)), w->size());
never executed (the execution status of this line is deduced): scrollerRegion = QRect(w->mapToGlobal(QPoint(0, 0)), w->size());
-
581#ifndef QT_NO_GRAPHICSVIEW -
582 } else if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(as->target())) {
never executed: }
never evaluated: QGraphicsObject *go = qobject_cast<QGraphicsObject *>(as->target())
0
583 if (go->scene() && !go->scene()->views().isEmpty()) {
never evaluated: go->scene()
never evaluated: !go->scene()->views().isEmpty()
0
584 foreach (QGraphicsView *gv, go->scene()->views())
never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(go->scene()->views())> _container_(go->scene()->views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *gv = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
585 scrollerRegion |= gv->mapFromScene(go->mapToScene(go->boundingRect()))
never executed: scrollerRegion |= gv->mapFromScene(go->mapToScene(go->boundingRect())) .translated(gv->mapToGlobal(QPoint(0, 0)));
0
586 .translated(gv->mapToGlobal(QPoint(0, 0)));
never executed: scrollerRegion |= gv->mapFromScene(go->mapToScene(go->boundingRect())) .translated(gv->mapToGlobal(QPoint(0, 0)));
0
587 }
never executed: }
0
588#endif -
589 }
never executed: }
0
590 // active scrollers always have priority -
591 if (scrollerRegion.contains(globalPos))
never evaluated: scrollerRegion.contains(globalPos)
0
592 return Ignore;
never executed: return Ignore;
0
593 }
never executed: }
0
594 }
never executed: }
0
595 }
executed: }
Execution Count:7
7
596 -
597 bool scrollerWasDragging = (scroller->state() == QScroller::Dragging);
executed (the execution status of this line is deduced): bool scrollerWasDragging = (scroller->state() == QScroller::Dragging);
-
598 bool scrollerWasScrolling = (scroller->state() == QScroller::Scrolling);
executed (the execution status of this line is deduced): bool scrollerWasScrolling = (scroller->state() == QScroller::Scrolling);
-
599 -
600 if (inputType) {
partially evaluated: inputType
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
601 if (QWidget *w = qobject_cast<QWidget *>(d->receiver))
partially evaluated: QWidget *w = qobject_cast<QWidget *>(d->receiver)
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
602 point = w->mapFromGlobal(point.toPoint());
executed: point = w->mapFromGlobal(point.toPoint());
Execution Count:21
21
603#ifndef QT_NO_GRAPHICSVIEW -
604 else if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(d->receiver))
never evaluated: QGraphicsObject *go = qobject_cast<QGraphicsObject *>(d->receiver)
0
605 point = go->mapFromScene(point);
never executed: point = go->mapFromScene(point);
0
606#endif -
607 -
608 // inform the scroller about the new event -
609 scroller->handleInput(inputType, point, monotonicTimer.elapsed());
executed (the execution status of this line is deduced): scroller->handleInput(inputType, point, monotonicTimer.elapsed());
-
610 }
executed: }
Execution Count:21
21
611 -
612 // depending on the scroller state return the gesture state -
613 Result result(0);
executed (the execution status of this line is deduced): Result result(0);
-
614 bool scrollerIsActive = (scroller->state() == QScroller::Dragging ||
evaluated: scroller->state() == QScroller::Dragging
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:16
5-16
615 scroller->state() == QScroller::Scrolling);
evaluated: scroller->state() == QScroller::Scrolling
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:11
5-11
616 -
617 // Consume all mouse events while dragging or scrolling to avoid nasty -
618 // side effects with Qt's standard widgets. -
619 if ((me
partially evaluated: me
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
620#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
621 || gsme
partially evaluated: gsme
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
622#endif
executed (the execution status of this line is deduced):
-
623 ) && scrollerIsActive)
never evaluated: scrollerIsActive
0
624 result |= ConsumeEventHint;
never executed: result |= ConsumeEventHint;
0
625 -
626 // The only problem with this approach is that we consume the -
627 // MouseRelease when we start the scrolling with a flick gesture, so we -
628 // have to fake a MouseRelease "somewhere" to not mess with the internal -
629 // states of Qt's widgets (a QPushButton would stay in 'pressed' state -
630 // forever, if it doesn't receive a MouseRelease). -
631 if (me
partially evaluated: me
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
632#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
633 || gsme
partially evaluated: gsme
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
634#endif -
635 ) { -
636 if (!scrollerWasDragging && !scrollerWasScrolling && scrollerIsActive)
never evaluated: !scrollerWasDragging
never evaluated: !scrollerWasScrolling
never evaluated: scrollerIsActive
0
637 PressDelayHandler::instance()->scrollerBecameActive();
never executed: PressDelayHandler::instance()->scrollerBecameActive();
0
638 else if (scrollerWasScrolling && (scroller->state() == QScroller::Dragging || scroller->state() == QScroller::Inactive))
never evaluated: scrollerWasScrolling
never evaluated: scroller->state() == QScroller::Dragging
never evaluated: scroller->state() == QScroller::Inactive
0
639 PressDelayHandler::instance()->scrollerWasIntercepted();
never executed: PressDelayHandler::instance()->scrollerWasIntercepted();
0
640 } -
641 -
642 if (!inputType) {
partially evaluated: !inputType
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
643 result |= Ignore;
never executed (the execution status of this line is deduced): result |= Ignore;
-
644 } else {
never executed: }
0
645 switch (event->type()) { -
646 case QEvent::MouseButtonPress: -
647#ifndef QT_NO_GRAPHICSVIEW -
648 case QEvent::GraphicsSceneMousePress: -
649#endif -
650 if (scroller->state() == QScroller::Pressed) {
never evaluated: scroller->state() == QScroller::Pressed
0
651 int pressDelay = int(1000 * scroller->scrollerProperties().scrollMetric(QScrollerProperties::MousePressEventDelay).toReal());
never executed (the execution status of this line is deduced): int pressDelay = int(1000 * scroller->scrollerProperties().scrollMetric(QScrollerProperties::MousePressEventDelay).toReal());
-
652 if (pressDelay > 0) {
never evaluated: pressDelay > 0
0
653 result |= ConsumeEventHint;
never executed (the execution status of this line is deduced): result |= ConsumeEventHint;
-
654 -
655 PressDelayHandler::instance()->pressed(event, pressDelay);
never executed (the execution status of this line is deduced): PressDelayHandler::instance()->pressed(event, pressDelay);
-
656 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
657 }
never executed: }
0
658 }
never executed: }
0
659 // fall through -
660 case QEvent::TouchBegin:
code before this statement never executed: case QEvent::TouchBegin:
0
661 q->setHotSpot(globalPos);
executed (the execution status of this line is deduced): q->setHotSpot(globalPos);
-
662 result |= scrollerIsActive ? TriggerGesture : MayBeGesture;
partially evaluated: scrollerIsActive
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
663 break;
executed: break;
Execution Count:7
7
664 -
665 case QEvent::MouseMove: -
666#ifndef QT_NO_GRAPHICSVIEW -
667 case QEvent::GraphicsSceneMouseMove: -
668#endif -
669 if (PressDelayHandler::instance()->isDelaying())
never evaluated: PressDelayHandler::instance()->isDelaying()
0
670 result |= ConsumeEventHint;
never executed: result |= ConsumeEventHint;
0
671 // fall through -
672 case QEvent::TouchUpdate:
code before this statement never executed: case QEvent::TouchUpdate:
0
673 result |= scrollerIsActive ? TriggerGesture : Ignore;
evaluated: scrollerIsActive
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
674 break;
executed: break;
Execution Count:7
7
675 -
676#ifndef QT_NO_GRAPHICSVIEW -
677 case QEvent::GraphicsSceneMouseRelease: -
678#endif -
679 case QEvent::MouseButtonRelease: -
680 if (PressDelayHandler::instance()->released(event, scrollerWasDragging || scrollerWasScrolling, scrollerIsActive))
never evaluated: PressDelayHandler::instance()->released(event, scrollerWasDragging || scrollerWasScrolling, scrollerIsActive)
0
681 result |= ConsumeEventHint;
never executed: result |= ConsumeEventHint;
0
682 // fall through -
683 case QEvent::TouchEnd:
code before this statement never executed: case QEvent::TouchEnd:
0
684 result |= scrollerIsActive ? FinishGesture : CancelGesture;
evaluated: scrollerIsActive
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
685 break;
executed: break;
Execution Count:7
7
686 -
687 default: -
688 result |= Ignore;
never executed (the execution status of this line is deduced): result |= Ignore;
-
689 break;
never executed: break;
0
690 } -
691 }
executed: }
Execution Count:21
21
692 return result;
executed: return result;
Execution Count:21
21
693} -
694 -
695 -
696/*! \reimp -
697 */ -
698void QFlickGestureRecognizer::reset(QGesture *state) -
699{ -
700 QGestureRecognizer::reset(state);
executed (the execution status of this line is deduced): QGestureRecognizer::reset(state);
-
701}
executed: }
Execution Count:12
12
702 -
703QT_END_NAMESPACE -
704 -
705#endif // QT_NO_GESTURES -
706 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial