kernel/qgesture.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5QGesture::QGesture(QObject *parent) -
6 : QObject(*new QGesturePrivate, parent) -
7{ -
8 d_func()->gestureType = Qt::CustomGesture; -
9}
executed: }
Execution Count:129
129
10 -
11 -
12 -
13 -
14QGesture::QGesture(QGesturePrivate &dd, QObject *parent) -
15 : QObject(dd, parent) -
16{ -
17}
executed: }
Execution Count:5405
5405
18 -
19 -
20 -
21 -
22QGesture::~QGesture() -
23{ -
24} -
25Qt::GestureType QGesture::gestureType() const -
26{ -
27 return d_func()->gestureType;
executed: return d_func()->gestureType;
Execution Count:9077
9077
28} -
29 -
30Qt::GestureState QGesture::state() const -
31{ -
32 return d_func()->state;
executed: return d_func()->state;
Execution Count:1798
1798
33} -
34 -
35QPointF QGesture::hotSpot() const -
36{ -
37 return d_func()->hotSpot;
executed: return d_func()->hotSpot;
Execution Count:192
192
38} -
39 -
40void QGesture::setHotSpot(const QPointF &value) -
41{ -
42 QGesturePrivate * const d = d_func(); -
43 d->hotSpot = value; -
44 d->isHotSpotSet = true; -
45}
executed: }
Execution Count:226
226
46 -
47bool QGesture::hasHotSpot() const -
48{ -
49 return d_func()->isHotSpotSet;
executed: return d_func()->isHotSpotSet;
Execution Count:297
297
50} -
51 -
52void QGesture::unsetHotSpot() -
53{ -
54 d_func()->isHotSpotSet = false; -
55}
never executed: }
0
56void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy) -
57{ -
58 QGesturePrivate * const d = d_func(); -
59 d->gestureCancelPolicy = static_cast<uint>(policy); -
60}
executed: }
Execution Count:92
92
61 -
62QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const -
63{ -
64 const QGesturePrivate * const d = d_func(); -
65 return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy);
executed: return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy);
Execution Count:110
110
66} -
67QPanGesture::QPanGesture(QObject *parent) -
68 : QGesture(*new QPanGesturePrivate, parent) -
69{ -
70 d_func()->gestureType = Qt::PanGesture; -
71}
executed: }
Execution Count:5176
5176
72 -
73 -
74 -
75 -
76QPanGesture::~QPanGesture() -
77{ -
78} -
79 -
80QPointF QPanGesture::lastOffset() const -
81{ -
82 return d_func()->lastOffset;
never executed: return d_func()->lastOffset;
0
83} -
84 -
85QPointF QPanGesture::offset() const -
86{ -
87 return d_func()->offset;
never executed: return d_func()->offset;
0
88} -
89 -
90QPointF QPanGesture::delta() const -
91{ -
92 const QPanGesturePrivate * const d = d_func(); -
93 return d->offset - d->lastOffset;
never executed: return d->offset - d->lastOffset;
0
94} -
95 -
96qreal QPanGesture::acceleration() const -
97{ -
98 return d_func()->acceleration;
never executed: return d_func()->acceleration;
0
99} -
100 -
101void QPanGesture::setLastOffset(const QPointF &value) -
102{ -
103 d_func()->lastOffset = value; -
104}
never executed: }
0
105 -
106void QPanGesture::setOffset(const QPointF &value) -
107{ -
108 d_func()->offset = value; -
109}
never executed: }
0
110 -
111void QPanGesture::setAcceleration(qreal value) -
112{ -
113 d_func()->acceleration = value; -
114}
never executed: }
0
115QPinchGesture::QPinchGesture(QObject *parent) -
116 : QGesture(*new QPinchGesturePrivate, parent) -
117{ -
118 d_func()->gestureType = Qt::PinchGesture; -
119}
executed: }
Execution Count:56
56
120 -
121 -
122 -
123 -
124QPinchGesture::~QPinchGesture() -
125{ -
126} -
127 -
128QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const -
129{ -
130 return d_func()->totalChangeFlags;
never executed: return d_func()->totalChangeFlags;
0
131} -
132 -
133void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value) -
134{ -
135 d_func()->totalChangeFlags = value; -
136}
never executed: }
0
137 -
138QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const -
139{ -
140 return d_func()->changeFlags;
never executed: return d_func()->changeFlags;
0
141} -
142 -
143void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value) -
144{ -
145 d_func()->changeFlags = value; -
146}
never executed: }
0
147 -
148QPointF QPinchGesture::startCenterPoint() const -
149{ -
150 return d_func()->startCenterPoint;
never executed: return d_func()->startCenterPoint;
0
151} -
152 -
153QPointF QPinchGesture::lastCenterPoint() const -
154{ -
155 return d_func()->lastCenterPoint;
never executed: return d_func()->lastCenterPoint;
0
156} -
157 -
158QPointF QPinchGesture::centerPoint() const -
159{ -
160 return d_func()->centerPoint;
never executed: return d_func()->centerPoint;
0
161} -
162 -
163void QPinchGesture::setStartCenterPoint(const QPointF &value) -
164{ -
165 d_func()->startCenterPoint = value; -
166}
never executed: }
0
167 -
168void QPinchGesture::setLastCenterPoint(const QPointF &value) -
169{ -
170 d_func()->lastCenterPoint = value; -
171}
never executed: }
0
172 -
173void QPinchGesture::setCenterPoint(const QPointF &value) -
174{ -
175 d_func()->centerPoint = value; -
176}
never executed: }
0
177 -
178 -
179qreal QPinchGesture::totalScaleFactor() const -
180{ -
181 return d_func()->totalScaleFactor;
never executed: return d_func()->totalScaleFactor;
0
182} -
183 -
184qreal QPinchGesture::lastScaleFactor() const -
185{ -
186 return d_func()->lastScaleFactor;
never executed: return d_func()->lastScaleFactor;
0
187} -
188 -
189qreal QPinchGesture::scaleFactor() const -
190{ -
191 return d_func()->scaleFactor;
never executed: return d_func()->scaleFactor;
0
192} -
193 -
194void QPinchGesture::setTotalScaleFactor(qreal value) -
195{ -
196 d_func()->totalScaleFactor = value; -
197}
never executed: }
0
198 -
199void QPinchGesture::setLastScaleFactor(qreal value) -
200{ -
201 d_func()->lastScaleFactor = value; -
202}
never executed: }
0
203 -
204void QPinchGesture::setScaleFactor(qreal value) -
205{ -
206 d_func()->scaleFactor = value; -
207}
never executed: }
0
208 -
209 -
210qreal QPinchGesture::totalRotationAngle() const -
211{ -
212 return d_func()->totalRotationAngle;
never executed: return d_func()->totalRotationAngle;
0
213} -
214 -
215qreal QPinchGesture::lastRotationAngle() const -
216{ -
217 return d_func()->lastRotationAngle;
never executed: return d_func()->lastRotationAngle;
0
218} -
219 -
220qreal QPinchGesture::rotationAngle() const -
221{ -
222 return d_func()->rotationAngle;
never executed: return d_func()->rotationAngle;
0
223} -
224 -
225void QPinchGesture::setTotalRotationAngle(qreal value) -
226{ -
227 d_func()->totalRotationAngle = value; -
228}
never executed: }
0
229 -
230void QPinchGesture::setLastRotationAngle(qreal value) -
231{ -
232 d_func()->lastRotationAngle = value; -
233}
never executed: }
0
234 -
235void QPinchGesture::setRotationAngle(qreal value) -
236{ -
237 d_func()->rotationAngle = value; -
238}
never executed: }
0
239QSwipeGesture::QSwipeGesture(QObject *parent) -
240 : QGesture(*new QSwipeGesturePrivate, parent) -
241{ -
242 d_func()->gestureType = Qt::SwipeGesture; -
243}
executed: }
Execution Count:56
56
244 -
245 -
246 -
247 -
248QSwipeGesture::~QSwipeGesture() -
249{ -
250} -
251 -
252QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const -
253{ -
254 const QSwipeGesturePrivate * const d = d_func(); -
255 if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270)
never evaluated: d->swipeAngle == 90
never evaluated: d->swipeAngle == 270
never evaluated: d->swipeAngle < 0
0
256 return QSwipeGesture::NoDirection;
never executed: return QSwipeGesture::NoDirection;
0
257 else if (d->swipeAngle < 90 || d->swipeAngle > 270)
never evaluated: d->swipeAngle < 90
never evaluated: d->swipeAngle > 270
0
258 return QSwipeGesture::Right;
never executed: return QSwipeGesture::Right;
0
259 else -
260 return QSwipeGesture::Left;
never executed: return QSwipeGesture::Left;
0
261} -
262 -
263QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const -
264{ -
265 const QSwipeGesturePrivate * const d = d_func(); -
266 if (d->swipeAngle <= 0 || d->swipeAngle == 180)
never evaluated: d->swipeAngle <= 0
never evaluated: d->swipeAngle == 180
0
267 return QSwipeGesture::NoDirection;
never executed: return QSwipeGesture::NoDirection;
0
268 else if (d->swipeAngle < 180)
never evaluated: d->swipeAngle < 180
0
269 return QSwipeGesture::Up;
never executed: return QSwipeGesture::Up;
0
270 else -
271 return QSwipeGesture::Down;
never executed: return QSwipeGesture::Down;
0
272} -
273 -
274qreal QSwipeGesture::swipeAngle() const -
275{ -
276 return d_func()->swipeAngle;
never executed: return d_func()->swipeAngle;
0
277} -
278 -
279void QSwipeGesture::setSwipeAngle(qreal value) -
280{ -
281 d_func()->swipeAngle = value; -
282}
never executed: }
0
283QTapGesture::QTapGesture(QObject *parent) -
284 : QGesture(*new QTapGesturePrivate, parent) -
285{ -
286 d_func()->gestureType = Qt::TapGesture; -
287}
executed: }
Execution Count:57
57
288 -
289 -
290 -
291 -
292QTapGesture::~QTapGesture() -
293{ -
294} -
295 -
296QPointF QTapGesture::position() const -
297{ -
298 return d_func()->position;
never executed: return d_func()->position;
0
299} -
300 -
301void QTapGesture::setPosition(const QPointF &value) -
302{ -
303 d_func()->position = value; -
304}
never executed: }
0
305QTapAndHoldGesture::QTapAndHoldGesture(QObject *parent) -
306 : QGesture(*new QTapAndHoldGesturePrivate, parent) -
307{ -
308 d_func()->gestureType = Qt::TapAndHoldGesture; -
309}
executed: }
Execution Count:56
56
310 -
311 -
312 -
313 -
314QTapAndHoldGesture::~QTapAndHoldGesture() -
315{ -
316} -
317 -
318QPointF QTapAndHoldGesture::position() const -
319{ -
320 return d_func()->position;
never executed: return d_func()->position;
0
321} -
322 -
323void QTapAndHoldGesture::setPosition(const QPointF &value) -
324{ -
325 d_func()->position = value; -
326}
never executed: }
0
327void QTapAndHoldGesture::setTimeout(int msecs) -
328{ -
329 QTapAndHoldGesturePrivate::Timeout = msecs; -
330}
never executed: }
0
331int QTapAndHoldGesture::timeout() -
332{ -
333 return QTapAndHoldGesturePrivate::Timeout;
never executed: return QTapAndHoldGesturePrivate::Timeout;
0
334} -
335 -
336int QTapAndHoldGesturePrivate::Timeout = 700; -
337QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures) -
338 : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(0) -
339 -
340{ -
341}
executed: }
Execution Count:795
795
342 -
343 -
344 -
345 -
346QGestureEvent::~QGestureEvent() -
347{ -
348} -
349 -
350 -
351 -
352 -
353QList<QGesture *> QGestureEvent::gestures() const -
354{ -
355 return m_gestures;
executed: return m_gestures;
Execution Count:1218
1218
356} -
357 -
358 -
359 -
360 -
361QGesture *QGestureEvent::gesture(Qt::GestureType type) const -
362{ -
363 for (int i = 0; i < m_gestures.size(); ++i)
evaluated: i < m_gestures.size()
TRUEFALSE
yes
Evaluation Count:464
yes
Evaluation Count:194
194-464
364 if (m_gestures.at(i)->gestureType() == type)
evaluated: m_gestures.at(i)->gestureType() == type
TRUEFALSE
yes
Evaluation Count:138
yes
Evaluation Count:326
138-326
365 return m_gestures.at(i);
executed: return m_gestures.at(i);
Execution Count:138
138
366 return 0;
executed: return 0;
Execution Count:194
194
367} -
368 -
369 -
370 -
371 -
372QList<QGesture *> QGestureEvent::activeGestures() const -
373{ -
374 QList<QGesture *> gestures; -
375 for (QForeachContainer<__typeof__(m_gestures)> _container_(m_gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
376 if (gesture->state() != Qt::GestureCanceled)
never evaluated: gesture->state() != Qt::GestureCanceled
0
377 gestures.append(gesture);
never executed: gestures.append(gesture);
0
378 }
never executed: }
0
379 return gestures;
never executed: return gestures;
0
380} -
381 -
382 -
383 -
384 -
385QList<QGesture *> QGestureEvent::canceledGestures() const -
386{ -
387 QList<QGesture *> gestures; -
388 for (QForeachContainer<__typeof__(m_gestures)> _container_(m_gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
389 if (gesture->state() == Qt::GestureCanceled)
never evaluated: gesture->state() == Qt::GestureCanceled
0
390 gestures.append(gesture);
never executed: gestures.append(gesture);
0
391 }
never executed: }
0
392 return gestures;
never executed: return gestures;
0
393} -
394void QGestureEvent::setAccepted(QGesture *gesture, bool value) -
395{ -
396 if (gesture)
partially evaluated: gesture
TRUEFALSE
yes
Evaluation Count:352
no
Evaluation Count:0
0-352
397 setAccepted(gesture->gestureType(), value);
executed: setAccepted(gesture->gestureType(), value);
Execution Count:352
352
398}
executed: }
Execution Count:352
352
399void QGestureEvent::accept(QGesture *gesture) -
400{ -
401 if (gesture)
never evaluated: gesture
0
402 setAccepted(gesture->gestureType(), true);
never executed: setAccepted(gesture->gestureType(), true);
0
403}
never executed: }
0
404void QGestureEvent::ignore(QGesture *gesture) -
405{ -
406 if (gesture)
evaluated: gesture
TRUEFALSE
yes
Evaluation Count:150
yes
Evaluation Count:192
150-192
407 setAccepted(gesture->gestureType(), false);
executed: setAccepted(gesture->gestureType(), false);
Execution Count:150
150
408}
executed: }
Execution Count:342
342
409 -
410 -
411 -
412 -
413bool QGestureEvent::isAccepted(QGesture *gesture) const -
414{ -
415 return gesture ? isAccepted(gesture->gestureType()) : false;
executed: return gesture ? isAccepted(gesture->gestureType()) : false;
Execution Count:320
320
416} -
417void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value) -
418{ -
419 setAccepted(false); -
420 m_accepted[gestureType] = value; -
421}
executed: }
Execution Count:502
502
422void QGestureEvent::accept(Qt::GestureType gestureType) -
423{ -
424 setAccepted(gestureType, true); -
425}
never executed: }
0
426void QGestureEvent::ignore(Qt::GestureType gestureType) -
427{ -
428 setAccepted(gestureType, false); -
429}
never executed: }
0
430 -
431 -
432 -
433 -
434 -
435bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const -
436{ -
437 return m_accepted.value(gestureType, true);
executed: return m_accepted.value(gestureType, true);
Execution Count:320
320
438} -
439 -
440 -
441 -
442 -
443 -
444 -
445void QGestureEvent::setWidget(QWidget *widget) -
446{ -
447 m_widget = widget; -
448}
executed: }
Execution Count:350
350
449 -
450 -
451 -
452 -
453QWidget *QGestureEvent::widget() const -
454{ -
455 return m_widget;
executed: return m_widget;
Execution Count:351
351
456} -
457QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const -
458{ -
459 QWidget *w = widget(); -
460 if (w)
evaluated: w
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
461 w = w->parentWidget();
executed: w = w->parentWidget();
Execution Count:1
1
462 QGraphicsView *view = qobject_cast<QGraphicsView*>(w); -
463 if (view) {
evaluated: view
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
464 return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint()));
executed: return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint()));
Execution Count:1
1
465 } -
466 return QPointF();
executed: return QPointF();
Execution Count:1
1
467} -
468 -
469 -
470 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial