kernel/qgesturemanager.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 "private/qgesturemanager_p.h" -
43#include "private/qstandardgestures_p.h" -
44#include "private/qwidget_p.h" -
45#include "private/qgesture_p.h" -
46#include "private/qgraphicsitem_p.h" -
47#include "private/qevent_p.h" -
48#include "private/qapplication_p.h" -
49#include "private/qwidgetwindow_qpa_p.h" -
50#include "qgesture.h" -
51#include "qevent.h" -
52#include "qgraphicsitem.h" -
53 -
54#ifdef Q_WS_MAC -
55#include "qmacgesturerecognizer_mac_p.h" -
56#endif -
57#if defined(Q_WS_WIN) && !defined(QT_NO_NATIVE_GESTURES) -
58#include "qwinnativepangesturerecognizer_win_p.h" -
59#endif -
60 -
61#include "qdebug.h" -
62 -
63// #define GESTURE_DEBUG -
64#ifndef GESTURE_DEBUG -
65# define DEBUG if (0) qDebug -
66#else -
67# define DEBUG qDebug -
68#endif -
69 -
70#ifndef QT_NO_GESTURES -
71 -
72QT_BEGIN_NAMESPACE -
73 -
74QGestureManager::QGestureManager(QObject *parent) -
75 : QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture) -
76{ -
77 qRegisterMetaType<Qt::GestureState>();
executed (the execution status of this line is deduced): qRegisterMetaType<Qt::GestureState>();
-
78 -
79#if defined(Q_WS_MAC) -
80 registerGestureRecognizer(new QMacSwipeGestureRecognizer); -
81 registerGestureRecognizer(new QMacPinchGestureRecognizer); -
82 registerGestureRecognizer(new QMacPanGestureRecognizer); -
83#else -
84 registerGestureRecognizer(new QPanGestureRecognizer);
executed (the execution status of this line is deduced): registerGestureRecognizer(new QPanGestureRecognizer);
-
85 registerGestureRecognizer(new QPinchGestureRecognizer);
executed (the execution status of this line is deduced): registerGestureRecognizer(new QPinchGestureRecognizer);
-
86 registerGestureRecognizer(new QSwipeGestureRecognizer);
executed (the execution status of this line is deduced): registerGestureRecognizer(new QSwipeGestureRecognizer);
-
87 registerGestureRecognizer(new QTapGestureRecognizer);
executed (the execution status of this line is deduced): registerGestureRecognizer(new QTapGestureRecognizer);
-
88#endif -
89#if defined(Q_WS_WIN) -
90 #if !defined(QT_NO_NATIVE_GESTURES) -
91 if (QApplicationPrivate::HasTouchSupport) -
92 registerGestureRecognizer(new QWinNativePanGestureRecognizer); -
93 #endif -
94#else -
95 registerGestureRecognizer(new QTapAndHoldGestureRecognizer);
executed (the execution status of this line is deduced): registerGestureRecognizer(new QTapAndHoldGestureRecognizer);
-
96#endif -
97}
executed: }
Execution Count:56
56
98 -
99QGestureManager::~QGestureManager() -
100{ -
101 qDeleteAll(m_recognizers.values());
executed (the execution status of this line is deduced): qDeleteAll(m_recognizers.values());
-
102 foreach (QGestureRecognizer *recognizer, m_obsoleteGestures.keys()) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(m_obsoleteGestures.keys())> _container_(m_obsoleteGestures.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGestureRecognizer *recognizer = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
103 qDeleteAll(m_obsoleteGestures.value(recognizer));
executed (the execution status of this line is deduced): qDeleteAll(m_obsoleteGestures.value(recognizer));
-
104 delete recognizer;
executed (the execution status of this line is deduced): delete recognizer;
-
105 }
executed: }
Execution Count:16
16
106 m_obsoleteGestures.clear();
executed (the execution status of this line is deduced): m_obsoleteGestures.clear();
-
107}
executed: }
Execution Count:56
56
108 -
109Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer) -
110{ -
111 QGesture *dummy = recognizer->create(0);
executed (the execution status of this line is deduced): QGesture *dummy = recognizer->create(0);
-
112 if (!dummy) {
partially evaluated: !dummy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:299
0-299
113 qWarning("QGestureManager::registerGestureRecognizer: "
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qgesturemanager.cpp", 113, __PRETTY_FUNCTION__).warning("QGestureManager::registerGestureRecognizer: "
-
114 "the recognizer fails to create a gesture object, skipping registration.");
never executed (the execution status of this line is deduced): "the recognizer fails to create a gesture object, skipping registration.");
-
115 return Qt::GestureType(0);
never executed: return Qt::GestureType(0);
0
116 } -
117 Qt::GestureType type = dummy->gestureType();
executed (the execution status of this line is deduced): Qt::GestureType type = dummy->gestureType();
-
118 if (type == Qt::CustomGesture) {
evaluated: type == Qt::CustomGesture
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:282
17-282
119 // generate a new custom gesture id -
120 ++m_lastCustomGestureId;
executed (the execution status of this line is deduced): ++m_lastCustomGestureId;
-
121 type = Qt::GestureType(m_lastCustomGestureId);
executed (the execution status of this line is deduced): type = Qt::GestureType(m_lastCustomGestureId);
-
122 }
executed: }
Execution Count:17
17
123 m_recognizers.insertMulti(type, recognizer);
executed (the execution status of this line is deduced): m_recognizers.insertMulti(type, recognizer);
-
124 delete dummy;
executed (the execution status of this line is deduced): delete dummy;
-
125 return type;
executed: return type;
Execution Count:299
299
126} -
127 -
128void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) -
129{ -
130 QList<QGestureRecognizer *> list = m_recognizers.values(type);
executed (the execution status of this line is deduced): QList<QGestureRecognizer *> list = m_recognizers.values(type);
-
131 while (QGestureRecognizer *recognizer = m_recognizers.take(type)) {
evaluated: QGestureRecognizer *recognizer = m_recognizers.take(type)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:21
16-21
132 if (!m_obsoleteGestures.contains(recognizer)) {
partially evaluated: !m_obsoleteGestures.contains(recognizer)
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
133 // inserting even an empty QSet will cause the recognizer to be deleted on destruction of the manager -
134 m_obsoleteGestures.insert(recognizer, QSet<QGesture *>());
executed (the execution status of this line is deduced): m_obsoleteGestures.insert(recognizer, QSet<QGesture *>());
-
135 }
executed: }
Execution Count:16
16
136 }
executed: }
Execution Count:16
16
137 foreach (QGesture *g, m_gestureToRecognizer.keys()) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(m_gestureToRecognizer.keys())> _container_(m_gestureToRecognizer.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
138 QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
executed (the execution status of this line is deduced): QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
-
139 if (list.contains(recognizer)) {
evaluated: list.contains(recognizer)
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:47
17-47
140 m_deletedRecognizers.insert(g, recognizer);
executed (the execution status of this line is deduced): m_deletedRecognizers.insert(g, recognizer);
-
141 }
executed: }
Execution Count:17
17
142 }
executed: }
Execution Count:64
64
143 -
144 QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.constBegin();
executed (the execution status of this line is deduced): QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.constBegin();
-
145 while (iter != m_objectGestures.constEnd()) {
evaluated: iter != m_objectGestures.constEnd()
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:21
21-96
146 ObjectGesture objectGesture = iter.key();
executed (the execution status of this line is deduced): ObjectGesture objectGesture = iter.key();
-
147 if (objectGesture.gesture == type) {
evaluated: objectGesture.gesture == type
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:80
16-80
148 foreach (QGesture *g, iter.value()) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(iter.value())> _container_(iter.value()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
149 if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g)) {
partially evaluated: QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g)
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
0-17
150 m_gestureToRecognizer.remove(g);
executed (the execution status of this line is deduced): m_gestureToRecognizer.remove(g);
-
151 m_obsoleteGestures[recognizer].insert(g);
executed (the execution status of this line is deduced): m_obsoleteGestures[recognizer].insert(g);
-
152 }
executed: }
Execution Count:17
17
153 }
executed: }
Execution Count:17
17
154 }
executed: }
Execution Count:16
16
155 ++iter;
executed (the execution status of this line is deduced): ++iter;
-
156 }
executed: }
Execution Count:96
96
157}
executed: }
Execution Count:21
21
158 -
159void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType type) -
160{ -
161 QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
executed (the execution status of this line is deduced): QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
-
162 while (iter != m_objectGestures.end()) {
evaluated: iter != m_objectGestures.end()
TRUEFALSE
yes
Evaluation Count:12171
yes
Evaluation Count:5516
5516-12171
163 ObjectGesture objectGesture = iter.key();
executed (the execution status of this line is deduced): ObjectGesture objectGesture = iter.key();
-
164 if (objectGesture.gesture == type && target == objectGesture.object) {
evaluated: objectGesture.gesture == type
TRUEFALSE
yes
Evaluation Count:11984
yes
Evaluation Count:187
evaluated: target == objectGesture.object
TRUEFALSE
yes
Evaluation Count:4588
yes
Evaluation Count:7396
187-11984
165 QSet<QGesture *> gestures = iter.value().toSet();
executed (the execution status of this line is deduced): QSet<QGesture *> gestures = iter.value().toSet();
-
166 for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator
executed (the execution status of this line is deduced): for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator
-
167 it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:999
yes
Evaluation Count:4588
999-4588
168 it.value() -= gestures;
executed (the execution status of this line is deduced): it.value() -= gestures;
-
169 }
executed: }
Execution Count:999
999
170 foreach (QGesture *g, gestures) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
171 m_deletedRecognizers.remove(g);
executed (the execution status of this line is deduced): m_deletedRecognizers.remove(g);
-
172 m_gestureToRecognizer.remove(g);
executed (the execution status of this line is deduced): m_gestureToRecognizer.remove(g);
-
173 m_maybeGestures.remove(g);
executed (the execution status of this line is deduced): m_maybeGestures.remove(g);
-
174 m_activeGestures.remove(g);
executed (the execution status of this line is deduced): m_activeGestures.remove(g);
-
175 m_gestureOwners.remove(g);
executed (the execution status of this line is deduced): m_gestureOwners.remove(g);
-
176 m_gestureTargets.remove(g);
executed (the execution status of this line is deduced): m_gestureTargets.remove(g);
-
177 m_gesturesToDelete.insert(g);
executed (the execution status of this line is deduced): m_gesturesToDelete.insert(g);
-
178 }
executed: }
Execution Count:4589
4589
179 -
180 iter = m_objectGestures.erase(iter);
executed (the execution status of this line is deduced): iter = m_objectGestures.erase(iter);
-
181 } else {
executed: }
Execution Count:4588
4588
182 ++iter;
executed (the execution status of this line is deduced): ++iter;
-
183 }
executed: }
Execution Count:7583
7583
184 } -
185}
executed: }
Execution Count:5516
5516
186 -
187// get or create a QGesture object that will represent the state for a given object, used by the recognizer -
188QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type) -
189{ -
190 // if the widget is being deleted we should be careful not to -
191 // create a new state, as it will create QWeakPointer which doesn't work -
192 // from the destructor. -
193 if (object->isWidgetType()) {
evaluated: object->isWidgetType()
TRUEFALSE
yes
Evaluation Count:60487
yes
Evaluation Count:488
488-60487
194 if (static_cast<QWidget *>(object)->d_func()->data.in_destructor)
partially evaluated: static_cast<QWidget *>(object)->d_func()->data.in_destructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60487
0-60487
195 return 0;
never executed: return 0;
0
196 } else if (QGesture *g = qobject_cast<QGesture *>(object)) {
executed: }
Execution Count:60487
partially evaluated: QGesture *g = qobject_cast<QGesture *>(object)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:488
0-60487
197 return g;
never executed: return g;
0
198#ifndef QT_NO_GRAPHICSVIEW -
199 } else { -
200 Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
executed (the execution status of this line is deduced): qt_noop();
-
201 QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);
executed (the execution status of this line is deduced): QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);
-
202 if (graphicsObject->QGraphicsItem::d_func()->inDestructor)
partially evaluated: graphicsObject->QGraphicsItem::d_func()->inDestructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:488
0-488
203 return 0;
never executed: return 0;
0
204#endif -
205 }
executed: }
Execution Count:488
488
206 -
207 // check if the QGesture for this recognizer has already been created -
208 foreach (QGesture *state, m_objectGestures.value(QGestureManager::ObjectGesture(object, type))) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(m_objectGestures.value(QGestureManager::ObjectGesture(object, type)))> _container_(m_objectGestures.value(QGestureManager::ObjectGesture(object, type))); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *state = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
209 if (m_gestureToRecognizer.value(state) == recognizer)
evaluated: m_gestureToRecognizer.value(state) == recognizer
TRUEFALSE
yes
Evaluation Count:55741
yes
Evaluation Count:1
1-55741
210 return state;
executed: return state;
Execution Count:55741
55741
211 }
executed: }
Execution Count:1
1
212 -
213 Q_ASSERT(recognizer);
executed (the execution status of this line is deduced): qt_noop();
-
214 QGesture *state = recognizer->create(object);
executed (the execution status of this line is deduced): QGesture *state = recognizer->create(object);
-
215 if (!state)
partially evaluated: !state
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5234
0-5234
216 return 0;
never executed: return 0;
0
217 state->setParent(this);
executed (the execution status of this line is deduced): state->setParent(this);
-
218 if (state->gestureType() == Qt::CustomGesture) {
evaluated: state->gestureType() == Qt::CustomGesture
TRUEFALSE
yes
Evaluation Count:115
yes
Evaluation Count:5119
115-5119
219 // if the recognizer didn't fill in the gesture type, then this -
220 // is a custom gesture with autogenerated id and we fill it. -
221 state->d_func()->gestureType = type;
executed (the execution status of this line is deduced): state->d_func()->gestureType = type;
-
222#if defined(GESTURE_DEBUG) -
223 state->setObjectName(QString::number((int)type)); -
224#endif -
225 }
executed: }
Execution Count:115
115
226 m_objectGestures[QGestureManager::ObjectGesture(object, type)].append(state);
executed (the execution status of this line is deduced): m_objectGestures[QGestureManager::ObjectGesture(object, type)].append(state);
-
227 m_gestureToRecognizer[state] = recognizer;
executed (the execution status of this line is deduced): m_gestureToRecognizer[state] = recognizer;
-
228 m_gestureOwners[state] = object;
executed (the execution status of this line is deduced): m_gestureOwners[state] = object;
-
229 -
230 return state;
executed: return state;
Execution Count:5234
5234
231} -
232 -
233bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *, -
234 Qt::GestureType> &contexts, -
235 QEvent *event) -
236{ -
237 QSet<QGesture *> triggeredGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> triggeredGestures;
-
238 QSet<QGesture *> finishedGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> finishedGestures;
-
239 QSet<QGesture *> newMaybeGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> newMaybeGestures;
-
240 QSet<QGesture *> notGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> notGestures;
-
241 -
242 // TODO: sort contexts by the gesture type and check if one of the contexts -
243 // is already active. -
244 -
245 bool consumeEventHint = false;
executed (the execution status of this line is deduced): bool consumeEventHint = false;
-
246 -
247 // filter the event through recognizers -
248 typedef QMultiMap<QObject *, Qt::GestureType>::const_iterator ContextIterator;
executed (the execution status of this line is deduced): typedef QMultiMap<QObject *, Qt::GestureType>::const_iterator ContextIterator;
-
249 ContextIterator contextEnd = contexts.end();
executed (the execution status of this line is deduced): ContextIterator contextEnd = contexts.end();
-
250 for (ContextIterator context = contexts.begin(); context != contextEnd; ++context) {
evaluated: context != contextEnd
TRUEFALSE
yes
Evaluation Count:61027
yes
Evaluation Count:60419
60419-61027
251 Qt::GestureType gestureType = context.value();
executed (the execution status of this line is deduced): Qt::GestureType gestureType = context.value();
-
252 const QMap<Qt::GestureType, QGestureRecognizer *> &const_recognizers = m_recognizers;
executed (the execution status of this line is deduced): const QMap<Qt::GestureType, QGestureRecognizer *> &const_recognizers = m_recognizers;
-
253 QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
executed (the execution status of this line is deduced): QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
-
254 typeToRecognizerIterator = const_recognizers.lowerBound(gestureType),
executed (the execution status of this line is deduced): typeToRecognizerIterator = const_recognizers.lowerBound(gestureType),
-
255 typeToRecognizerEnd = const_recognizers.upperBound(gestureType);
executed (the execution status of this line is deduced): typeToRecognizerEnd = const_recognizers.upperBound(gestureType);
-
256 for (; typeToRecognizerIterator != typeToRecognizerEnd; ++typeToRecognizerIterator) {
evaluated: typeToRecognizerIterator != typeToRecognizerEnd
TRUEFALSE
yes
Evaluation Count:60975
yes
Evaluation Count:61027
60975-61027
257 QGestureRecognizer *recognizer = typeToRecognizerIterator.value();
executed (the execution status of this line is deduced): QGestureRecognizer *recognizer = typeToRecognizerIterator.value();
-
258 QObject *target = context.key();
executed (the execution status of this line is deduced): QObject *target = context.key();
-
259 QGesture *state = getState(target, recognizer, gestureType);
executed (the execution status of this line is deduced): QGesture *state = getState(target, recognizer, gestureType);
-
260 if (!state)
partially evaluated: !state
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60975
0-60975
261 continue;
never executed: continue;
0
262 QGestureRecognizer::Result recognizerResult = recognizer->recognize(state, target, event);
executed (the execution status of this line is deduced): QGestureRecognizer::Result recognizerResult = recognizer->recognize(state, target, event);
-
263 QGestureRecognizer::Result recognizerState = recognizerResult & QGestureRecognizer::ResultState_Mask;
executed (the execution status of this line is deduced): QGestureRecognizer::Result recognizerState = recognizerResult & QGestureRecognizer::ResultState_Mask;
-
264 QGestureRecognizer::Result resultHint = recognizerResult & QGestureRecognizer::ResultHint_Mask;
executed (the execution status of this line is deduced): QGestureRecognizer::Result resultHint = recognizerResult & QGestureRecognizer::ResultHint_Mask;
-
265 if (recognizerState == QGestureRecognizer::TriggerGesture) {
evaluated: recognizerState == QGestureRecognizer::TriggerGesture
TRUEFALSE
yes
Evaluation Count:205
yes
Evaluation Count:60770
205-60770
266 DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 266, __PRETTY_FUNCTION__).debug() << "QGestureManager:Recognizer: gesture triggered: " << state;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:205
0-205
267 triggeredGestures << state;
executed (the execution status of this line is deduced): triggeredGestures << state;
-
268 } else if (recognizerState == QGestureRecognizer::FinishGesture) {
executed: }
Execution Count:205
evaluated: recognizerState == QGestureRecognizer::FinishGesture
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:60695
75-60695
269 DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 269, __PRETTY_FUNCTION__).debug() << "QGestureManager:Recognizer: gesture finished: " << state;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:75
0-75
270 finishedGestures << state;
executed (the execution status of this line is deduced): finishedGestures << state;
-
271 } else if (recognizerState == QGestureRecognizer::MayBeGesture) {
executed: }
Execution Count:75
evaluated: recognizerState == QGestureRecognizer::MayBeGesture
TRUEFALSE
yes
Evaluation Count:133
yes
Evaluation Count:60562
75-60562
272 DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 272, __PRETTY_FUNCTION__).debug() << "QGestureManager:Recognizer: maybe gesture: " << state;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:133
0-133
273 newMaybeGestures << state;
executed (the execution status of this line is deduced): newMaybeGestures << state;
-
274 } else if (recognizerState == QGestureRecognizer::CancelGesture) {
executed: }
Execution Count:133
evaluated: recognizerState == QGestureRecognizer::CancelGesture
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:60560
2-60560
275 DEBUG() << "QGestureManager:Recognizer: not gesture: " << state;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 275, __PRETTY_FUNCTION__).debug() << "QGestureManager:Recognizer: not gesture: " << state;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
276 notGestures << state;
executed (the execution status of this line is deduced): notGestures << state;
-
277 } else if (recognizerState == QGestureRecognizer::Ignore) {
executed: }
Execution Count:2
partially evaluated: recognizerState == QGestureRecognizer::Ignore
TRUEFALSE
yes
Evaluation Count:60560
no
Evaluation Count:0
0-60560
278 DEBUG() << "QGestureManager:Recognizer: ignored the event: " << state;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 278, __PRETTY_FUNCTION__).debug() << "QGestureManager:Recognizer: ignored the event: " << state;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60560
0-60560
279 } else {
executed: }
Execution Count:60560
60560
280 DEBUG() << "QGestureManager:Recognizer: hm, lets assume the recognizer"
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 280, __PRETTY_FUNCTION__).debug() << "QGestureManager:Recognizer: hm, lets assume the recognizer" << "ignored the event: " << state;
never evaluated: 0
0
281 << "ignored the event: " << state;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 280, __PRETTY_FUNCTION__).debug() << "QGestureManager:Recognizer: hm, lets assume the recognizer" << "ignored the event: " << state;
0
282 }
never executed: }
0
283 if (resultHint & QGestureRecognizer::ConsumeEventHint) {
evaluated: resultHint & QGestureRecognizer::ConsumeEventHint
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:60963
12-60963
284 DEBUG() << "QGestureManager: we were asked to consume the event: "
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 284, __PRETTY_FUNCTION__).debug() << "QGestureManager: we were asked to consume the event: " << state;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
285 << state;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 284, __PRETTY_FUNCTION__).debug() << "QGestureManager: we were asked to consume the event: " << state;
0
286 consumeEventHint = true;
executed (the execution status of this line is deduced): consumeEventHint = true;
-
287 }
executed: }
Execution Count:12
12
288 }
executed: }
Execution Count:60975
60975
289 }
executed: }
Execution Count:61027
61027
290 if (!triggeredGestures.isEmpty() || !finishedGestures.isEmpty()
evaluated: !triggeredGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:60246
evaluated: !finishedGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:60183
63-60246
291 || !newMaybeGestures.isEmpty() || !notGestures.isEmpty()) {
evaluated: !newMaybeGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:60070
evaluated: !notGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:60068
2-60070
292 QSet<QGesture *> startedGestures = triggeredGestures - m_activeGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> startedGestures = triggeredGestures - m_activeGestures;
-
293 triggeredGestures &= m_activeGestures;
executed (the execution status of this line is deduced): triggeredGestures &= m_activeGestures;
-
294 -
295 // check if a running gesture switched back to maybe state -
296 QSet<QGesture *> activeToMaybeGestures = m_activeGestures & newMaybeGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> activeToMaybeGestures = m_activeGestures & newMaybeGestures;
-
297 -
298 // check if a maybe gesture switched to canceled - reset it but don't send an event -
299 QSet<QGesture *> maybeToCanceledGestures = m_maybeGestures & notGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> maybeToCanceledGestures = m_maybeGestures & notGestures;
-
300 -
301 // check if a running gesture switched back to not gesture state, -
302 // i.e. were canceled -
303 QSet<QGesture *> canceledGestures = m_activeGestures & notGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> canceledGestures = m_activeGestures & notGestures;
-
304 -
305 // new gestures in maybe state -
306 m_maybeGestures += newMaybeGestures;
executed (the execution status of this line is deduced): m_maybeGestures += newMaybeGestures;
-
307 -
308 // gestures that were in maybe state -
309 QSet<QGesture *> notMaybeGestures = (startedGestures | triggeredGestures
executed (the execution status of this line is deduced): QSet<QGesture *> notMaybeGestures = (startedGestures | triggeredGestures
-
310 | finishedGestures | canceledGestures
executed (the execution status of this line is deduced): | finishedGestures | canceledGestures
-
311 | notGestures);
executed (the execution status of this line is deduced): | notGestures);
-
312 m_maybeGestures -= notMaybeGestures;
executed (the execution status of this line is deduced): m_maybeGestures -= notMaybeGestures;
-
313 -
314 Q_ASSERT((startedGestures & finishedGestures).isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
315 Q_ASSERT((startedGestures & newMaybeGestures).isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
316 Q_ASSERT((startedGestures & canceledGestures).isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
317 Q_ASSERT((finishedGestures & newMaybeGestures).isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
318 Q_ASSERT((finishedGestures & canceledGestures).isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
319 Q_ASSERT((canceledGestures & newMaybeGestures).isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
320 -
321 QSet<QGesture *> notStarted = finishedGestures - m_activeGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> notStarted = finishedGestures - m_activeGestures;
-
322 if (!notStarted.isEmpty()) {
evaluated: !notStarted.isEmpty()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:342
9-342
323 // there are some gestures that claim to be finished, but never started. -
324 // probably those are "singleshot" gestures so we'll fake the started state. -
325 foreach (QGesture *gesture, notStarted)
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(notStarted)> _container_(notStarted); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
326 gesture->d_func()->state = Qt::GestureStarted;
executed: gesture->d_func()->state = Qt::GestureStarted;
Execution Count:9
9
327 QSet<QGesture *> undeliveredGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> undeliveredGestures;
-
328 deliverEvents(notStarted, &undeliveredGestures);
executed (the execution status of this line is deduced): deliverEvents(notStarted, &undeliveredGestures);
-
329 finishedGestures -= undeliveredGestures;
executed (the execution status of this line is deduced): finishedGestures -= undeliveredGestures;
-
330 }
executed: }
Execution Count:9
9
331 -
332 m_activeGestures += startedGestures;
executed (the execution status of this line is deduced): m_activeGestures += startedGestures;
-
333 // sanity check: all triggered gestures should already be in active gestures list -
334 Q_ASSERT((m_activeGestures & triggeredGestures).size() == triggeredGestures.size());
executed (the execution status of this line is deduced): qt_noop();
-
335 m_activeGestures -= finishedGestures;
executed (the execution status of this line is deduced): m_activeGestures -= finishedGestures;
-
336 m_activeGestures -= activeToMaybeGestures;
executed (the execution status of this line is deduced): m_activeGestures -= activeToMaybeGestures;
-
337 m_activeGestures -= canceledGestures;
executed (the execution status of this line is deduced): m_activeGestures -= canceledGestures;
-
338 -
339 // set the proper gesture state on each gesture -
340 foreach (QGesture *gesture, startedGestures)
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(startedGestures)> _container_(startedGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
341 gesture->d_func()->state = Qt::GestureStarted;
executed: gesture->d_func()->state = Qt::GestureStarted;
Execution Count:78
78
342 foreach (QGesture *gesture, triggeredGestures)
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(triggeredGestures)> _container_(triggeredGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
343 gesture->d_func()->state = Qt::GestureUpdated;
executed: gesture->d_func()->state = Qt::GestureUpdated;
Execution Count:127
127
344 foreach (QGesture *gesture, finishedGestures)
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(finishedGestures)> _container_(finishedGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
345 gesture->d_func()->state = Qt::GestureFinished;
executed: gesture->d_func()->state = Qt::GestureFinished;
Execution Count:74
74
346 foreach (QGesture *gesture, canceledGestures)
never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(canceledGestures)> _container_(canceledGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
347 gesture->d_func()->state = Qt::GestureCanceled;
never executed: gesture->d_func()->state = Qt::GestureCanceled;
0
348 foreach (QGesture *gesture, activeToMaybeGestures)
never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(activeToMaybeGestures)> _container_(activeToMaybeGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
349 gesture->d_func()->state = Qt::GestureFinished;
never executed: gesture->d_func()->state = Qt::GestureFinished;
0
350 -
351 if (!m_activeGestures.isEmpty() || !m_maybeGestures.isEmpty() ||
evaluated: !m_activeGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:178
evaluated: !m_maybeGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:65
65-178
352 !startedGestures.isEmpty() || !triggeredGestures.isEmpty() ||
partially evaluated: !startedGestures.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65
partially evaluated: !triggeredGestures.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65
0-65
353 !finishedGestures.isEmpty() || !canceledGestures.isEmpty()) {
evaluated: !finishedGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:3
partially evaluated: !canceledGestures.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-62
354 DEBUG() << "QGestureManager::filterEventThroughContexts:"
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:348
0-348
355 << "\n\tactiveGestures:" << m_activeGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
0
356 << "\n\tmaybeGestures:" << m_maybeGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
0
357 << "\n\tstarted:" << startedGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
0
358 << "\n\ttriggered:" << triggeredGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
0
359 << "\n\tfinished:" << finishedGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
0
360 << "\n\tcanceled:" << canceledGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
0
361 << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 354, __PRETTY_FUNCTION__).debug() << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures << "\n\ttriggered:" << triggeredGestures << "\n\tfinished:" << finishedGestures << "\n\tcanceled:" << canceledGestures << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
0
362 }
executed: }
Execution Count:348
348
363 -
364 QSet<QGesture *> undeliveredGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> undeliveredGestures;
-
365 deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures,
executed (the execution status of this line is deduced): deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures,
-
366 &undeliveredGestures);
executed (the execution status of this line is deduced): &undeliveredGestures);
-
367 -
368 foreach (QGesture *g, startedGestures) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(startedGestures)> _container_(startedGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
369 if (undeliveredGestures.contains(g))
evaluated: undeliveredGestures.contains(g)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:70
8-70
370 continue;
executed: continue;
Execution Count:8
8
371 if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) {
evaluated: g->gestureCancelPolicy() == QGesture::CancelAllInContext
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:67
3-67
372 DEBUG() << "lets try to cancel some";
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 372, __PRETTY_FUNCTION__).debug() << "lets try to cancel some";
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
373 // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them -
374 cancelGesturesForChildren(g);
executed (the execution status of this line is deduced): cancelGesturesForChildren(g);
-
375 }
executed: }
Execution Count:3
3
376 }
executed: }
Execution Count:70
70
377 -
378 m_activeGestures -= undeliveredGestures;
executed (the execution status of this line is deduced): m_activeGestures -= undeliveredGestures;
-
379 -
380 // reset gestures that ended -
381 QSet<QGesture *> endedGestures =
executed (the execution status of this line is deduced): QSet<QGesture *> endedGestures =
-
382 finishedGestures + canceledGestures + undeliveredGestures + maybeToCanceledGestures;
executed (the execution status of this line is deduced): finishedGestures + canceledGestures + undeliveredGestures + maybeToCanceledGestures;
-
383 foreach (QGesture *gesture, endedGestures) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(endedGestures)> _container_(endedGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
384 recycle(gesture);
executed (the execution status of this line is deduced): recycle(gesture);
-
385 m_gestureTargets.remove(gesture);
executed (the execution status of this line is deduced): m_gestureTargets.remove(gesture);
-
386 }
executed: }
Execution Count:84
84
387 }
executed: }
Execution Count:351
351
388 //Clean up the Gestures -
389 qDeleteAll(m_gesturesToDelete);
executed (the execution status of this line is deduced): qDeleteAll(m_gesturesToDelete);
-
390 m_gesturesToDelete.clear();
executed (the execution status of this line is deduced): m_gesturesToDelete.clear();
-
391 -
392 return consumeEventHint;
executed: return consumeEventHint;
Execution Count:60419
60419
393} -
394 -
395// Cancel all gestures of children of the widget that original is associated with -
396void QGestureManager::cancelGesturesForChildren(QGesture *original) -
397{ -
398 Q_ASSERT(original);
executed (the execution status of this line is deduced): qt_noop();
-
399 QWidget *originatingWidget = m_gestureTargets.value(original);
executed (the execution status of this line is deduced): QWidget *originatingWidget = m_gestureTargets.value(original);
-
400 Q_ASSERT(originatingWidget);
executed (the execution status of this line is deduced): qt_noop();
-
401 -
402 // iterate over all active gestures and all maybe gestures -
403 // for each find the owner -
404 // if the owner is part of our sub-hierarchy, cancel it. -
405 -
406 QSet<QGesture*> cancelledGestures;
executed (the execution status of this line is deduced): QSet<QGesture*> cancelledGestures;
-
407 QSet<QGesture*>::Iterator iter = m_activeGestures.begin();
executed (the execution status of this line is deduced): QSet<QGesture*>::Iterator iter = m_activeGestures.begin();
-
408 while (iter != m_activeGestures.end()) {
evaluated: iter != m_activeGestures.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3
3-4
409 QWidget *widget = m_gestureTargets.value(*iter);
executed (the execution status of this line is deduced): QWidget *widget = m_gestureTargets.value(*iter);
-
410 // note that we don't touch the gestures for our originatingWidget -
411 if (widget != originatingWidget && originatingWidget->isAncestorOf(widget)) {
evaluated: widget != originatingWidget
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
partially evaluated: originatingWidget->isAncestorOf(widget)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-3
412 DEBUG() << " found a gesture to cancel" << (*iter);
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 412, __PRETTY_FUNCTION__).debug() << " found a gesture to cancel" << (*iter);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
413 (*iter)->d_func()->state = Qt::GestureCanceled;
executed (the execution status of this line is deduced): (*iter)->d_func()->state = Qt::GestureCanceled;
-
414 cancelledGestures << *iter;
executed (the execution status of this line is deduced): cancelledGestures << *iter;
-
415 iter = m_activeGestures.erase(iter);
executed (the execution status of this line is deduced): iter = m_activeGestures.erase(iter);
-
416 } else {
executed: }
Execution Count:1
1
417 ++iter;
executed (the execution status of this line is deduced): ++iter;
-
418 }
executed: }
Execution Count:3
3
419 } -
420 -
421 // TODO handle 'maybe' gestures too -
422 -
423 // sort them per target widget by cherry picking from almostCanceledGestures and delivering -
424 QSet<QGesture *> almostCanceledGestures = cancelledGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> almostCanceledGestures = cancelledGestures;
-
425 while (!almostCanceledGestures.isEmpty()) {
evaluated: !almostCanceledGestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
426 QWidget *target = 0;
executed (the execution status of this line is deduced): QWidget *target = 0;
-
427 QSet<QGesture*> gestures;
executed (the execution status of this line is deduced): QSet<QGesture*> gestures;
-
428 iter = almostCanceledGestures.begin();
executed (the execution status of this line is deduced): iter = almostCanceledGestures.begin();
-
429 // sort per target widget -
430 while (iter != almostCanceledGestures.end()) {
evaluated: iter != almostCanceledGestures.end()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
431 QWidget *widget = m_gestureTargets.value(*iter);
executed (the execution status of this line is deduced): QWidget *widget = m_gestureTargets.value(*iter);
-
432 if (target == 0)
partially evaluated: target == 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
433 target = widget;
executed: target = widget;
Execution Count:1
1
434 if (target == widget) {
partially evaluated: target == widget
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
435 gestures << *iter;
executed (the execution status of this line is deduced): gestures << *iter;
-
436 iter = almostCanceledGestures.erase(iter);
executed (the execution status of this line is deduced): iter = almostCanceledGestures.erase(iter);
-
437 } else {
executed: }
Execution Count:1
1
438 ++iter;
never executed (the execution status of this line is deduced): ++iter;
-
439 }
never executed: }
0
440 } -
441 Q_ASSERT(target);
executed (the execution status of this line is deduced): qt_noop();
-
442 -
443 QSet<QGesture*> undeliveredGestures;
executed (the execution status of this line is deduced): QSet<QGesture*> undeliveredGestures;
-
444 deliverEvents(gestures, &undeliveredGestures);
executed (the execution status of this line is deduced): deliverEvents(gestures, &undeliveredGestures);
-
445 }
executed: }
Execution Count:1
1
446 -
447 for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter)
evaluated: iter != cancelledGestures.end()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
448 recycle(*iter);
executed: recycle(*iter);
Execution Count:1
1
449}
executed: }
Execution Count:3
3
450 -
451void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) -
452{ -
453 QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture);
never executed (the execution status of this line is deduced): QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture);
-
454 if(!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed
never evaluated: !recognizer
0
455 return;
never executed: return;
0
456 m_deletedRecognizers.remove(gesture);
never executed (the execution status of this line is deduced): m_deletedRecognizers.remove(gesture);
-
457 if (m_deletedRecognizers.keys(recognizer).isEmpty()) {
never evaluated: m_deletedRecognizers.keys(recognizer).isEmpty()
0
458 // no more active gestures, cleanup! -
459 qDeleteAll(m_obsoleteGestures.value(recognizer));
never executed (the execution status of this line is deduced): qDeleteAll(m_obsoleteGestures.value(recognizer));
-
460 m_obsoleteGestures.remove(recognizer);
never executed (the execution status of this line is deduced): m_obsoleteGestures.remove(recognizer);
-
461 delete recognizer;
never executed (the execution status of this line is deduced): delete recognizer;
-
462 }
never executed: }
0
463}
never executed: }
0
464 -
465// return true if accepted (consumed) -
466bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) -
467{ -
468 QMap<Qt::GestureType, int> types;
executed (the execution status of this line is deduced): QMap<Qt::GestureType, int> types;
-
469 QMultiMap<QObject *, Qt::GestureType> contexts;
executed (the execution status of this line is deduced): QMultiMap<QObject *, Qt::GestureType> contexts;
-
470 QWidget *w = receiver;
executed (the execution status of this line is deduced): QWidget *w = receiver;
-
471 typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
executed (the execution status of this line is deduced): typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
-
472 if (!w->d_func()->gestureContext.isEmpty()) {
evaluated: !w->d_func()->gestureContext.isEmpty()
TRUEFALSE
yes
Evaluation Count:45908
yes
Evaluation Count:304808
45908-304808
473 for(ContextIterator it = w->d_func()->gestureContext.constBegin(),
executed (the execution status of this line is deduced): for(ContextIterator it = w->d_func()->gestureContext.constBegin(),
-
474 e = w->d_func()->gestureContext.constEnd(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:46398
yes
Evaluation Count:45908
45908-46398
475 types.insert(it.key(), 0);
executed (the execution status of this line is deduced): types.insert(it.key(), 0);
-
476 contexts.insertMulti(w, it.key());
executed (the execution status of this line is deduced): contexts.insertMulti(w, it.key());
-
477 }
executed: }
Execution Count:46398
46398
478 }
executed: }
Execution Count:45908
45908
479 // find all gesture contexts for the widget tree -
480 w = w->isWindow() ? 0 : w->parentWidget();
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:76407
yes
Evaluation Count:274309
76407-274309
481 while (w)
evaluated: w
TRUEFALSE
yes
Evaluation Count:522561
yes
Evaluation Count:76407
76407-522561
482 { -
483 for (ContextIterator it = w->d_func()->gestureContext.constBegin(),
executed (the execution status of this line is deduced): for (ContextIterator it = w->d_func()->gestureContext.constBegin(),
-
484 e = w->d_func()->gestureContext.constEnd(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:16381
yes
Evaluation Count:522561
16381-522561
485 if (!(it.value() & Qt::DontStartGestureOnChildren)) {
evaluated: !(it.value() & Qt::DontStartGestureOnChildren)
TRUEFALSE
yes
Evaluation Count:16358
yes
Evaluation Count:23
23-16358
486 if (!types.contains(it.key())) {
evaluated: !types.contains(it.key())
TRUEFALSE
yes
Evaluation Count:14141
yes
Evaluation Count:2217
2217-14141
487 types.insert(it.key(), 0);
executed (the execution status of this line is deduced): types.insert(it.key(), 0);
-
488 contexts.insertMulti(w, it.key());
executed (the execution status of this line is deduced): contexts.insertMulti(w, it.key());
-
489 }
executed: }
Execution Count:14141
14141
490 }
executed: }
Execution Count:16358
16358
491 }
executed: }
Execution Count:16381
16381
492 if (w->isWindow())
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:274309
yes
Evaluation Count:248252
248252-274309
493 break;
executed: break;
Execution Count:274309
274309
494 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
495 }
executed: }
Execution Count:248252
248252
496 return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
executed: return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
Execution Count:350716
350716
497} -
498 -
499#ifndef QT_NO_GRAPHICSVIEW -
500bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) -
501{ -
502 QMap<Qt::GestureType, int> types;
executed (the execution status of this line is deduced): QMap<Qt::GestureType, int> types;
-
503 QMultiMap<QObject *, Qt::GestureType> contexts;
executed (the execution status of this line is deduced): QMultiMap<QObject *, Qt::GestureType> contexts;
-
504 QGraphicsObject *item = receiver;
executed (the execution status of this line is deduced): QGraphicsObject *item = receiver;
-
505 if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
evaluated: !item->QGraphicsItem::d_func()->gestureContext.isEmpty()
TRUEFALSE
yes
Evaluation Count:460
yes
Evaluation Count:245
245-460
506 typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
executed (the execution status of this line is deduced): typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
-
507 for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
executed (the execution status of this line is deduced): for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
-
508 e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:460
yes
Evaluation Count:460
460
509 types.insert(it.key(), 0);
executed (the execution status of this line is deduced): types.insert(it.key(), 0);
-
510 contexts.insertMulti(item, it.key());
executed (the execution status of this line is deduced): contexts.insertMulti(item, it.key());
-
511 }
executed: }
Execution Count:460
460
512 }
executed: }
Execution Count:460
460
513 // find all gesture contexts for the graphics object tree -
514 item = item->parentObject();
executed (the execution status of this line is deduced): item = item->parentObject();
-
515 while (item)
evaluated: item
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:705
180-705
516 { -
517 typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
executed (the execution status of this line is deduced): typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
-
518 for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
executed (the execution status of this line is deduced): for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
-
519 e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:85
yes
Evaluation Count:180
85-180
520 if (!(it.value() & Qt::DontStartGestureOnChildren)) {
evaluated: !(it.value() & Qt::DontStartGestureOnChildren)
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:5
5-80
521 if (!types.contains(it.key())) {
evaluated: !types.contains(it.key())
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:52
28-52
522 types.insert(it.key(), 0);
executed (the execution status of this line is deduced): types.insert(it.key(), 0);
-
523 contexts.insertMulti(item, it.key());
executed (the execution status of this line is deduced): contexts.insertMulti(item, it.key());
-
524 }
executed: }
Execution Count:28
28
525 }
executed: }
Execution Count:80
80
526 }
executed: }
Execution Count:85
85
527 item = item->parentObject();
executed (the execution status of this line is deduced): item = item->parentObject();
-
528 }
executed: }
Execution Count:180
180
529 return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
executed: return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
Execution Count:705
705
530} -
531#endif -
532 -
533bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) -
534{ -
535 // if the receiver is actually a widget, we need to call the correct event -
536 // filter method. -
537 QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(receiver);
executed (the execution status of this line is deduced): QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(receiver);
-
538 -
539 if (widgetWindow)
evaluated: widgetWindow
TRUEFALSE
yes
Evaluation Count:15170
yes
Evaluation Count:23393
15170-23393
540 return filterEvent(widgetWindow->widget(), event);
executed: return filterEvent(widgetWindow->widget(), event);
Execution Count:15170
15170
541 -
542 if (!m_gestureToRecognizer.contains(static_cast<QGesture *>(receiver)))
partially evaluated: !m_gestureToRecognizer.contains(static_cast<QGesture *>(receiver))
TRUEFALSE
yes
Evaluation Count:23393
no
Evaluation Count:0
0-23393
543 return false;
executed: return false;
Execution Count:23393
23393
544 QGesture *state = static_cast<QGesture *>(receiver);
never executed (the execution status of this line is deduced): QGesture *state = static_cast<QGesture *>(receiver);
-
545 QMultiMap<QObject *, Qt::GestureType> contexts;
never executed (the execution status of this line is deduced): QMultiMap<QObject *, Qt::GestureType> contexts;
-
546 contexts.insert(state, state->gestureType());
never executed (the execution status of this line is deduced): contexts.insert(state, state->gestureType());
-
547 return filterEventThroughContexts(contexts, event);
never executed: return filterEventThroughContexts(contexts, event);
0
548} -
549 -
550void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures, -
551 QHash<QWidget *, QList<QGesture *> > *conflicts, -
552 QHash<QWidget *, QList<QGesture *> > *normal) -
553{ -
554 typedef QHash<Qt::GestureType, QHash<QWidget *, QGesture *> > GestureByTypes;
executed (the execution status of this line is deduced): typedef QHash<Qt::GestureType, QHash<QWidget *, QGesture *> > GestureByTypes;
-
555 GestureByTypes gestureByTypes;
executed (the execution status of this line is deduced): GestureByTypes gestureByTypes;
-
556 -
557 // sort gestures by types -
558 foreach (QGesture *gesture, gestures) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
559 QWidget *receiver = m_gestureTargets.value(gesture, 0);
executed (the execution status of this line is deduced): QWidget *receiver = m_gestureTargets.value(gesture, 0);
-
560 Q_ASSERT(receiver);
executed (the execution status of this line is deduced): qt_noop();
-
561 gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
executed (the execution status of this line is deduced): gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
-
562 }
executed: }
Execution Count:78
78
563 -
564 // for each gesture type -
565 foreach (Qt::GestureType type, gestureByTypes.keys()) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestureByTypes.keys())> _container_(gestureByTypes.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType type = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
566 QHash<QWidget *, QGesture *> gestures = gestureByTypes.value(type);
executed (the execution status of this line is deduced): QHash<QWidget *, QGesture *> gestures = gestureByTypes.value(type);
-
567 foreach (QWidget *widget, gestures.keys()) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures.keys())> _container_(gestures.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QWidget *widget = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
568 QWidget *w = widget->parentWidget();
executed (the execution status of this line is deduced): QWidget *w = widget->parentWidget();
-
569 while (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:16
16-68
570 QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it
executed (the execution status of this line is deduced): QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it
-
571 = w->d_func()->gestureContext.constFind(type);
executed (the execution status of this line is deduced): = w->d_func()->gestureContext.constFind(type);
-
572 if (it != w->d_func()->gestureContext.constEnd()) {
evaluated: it != w->d_func()->gestureContext.constEnd()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:54
14-54
573 // i.e. 'w' listens to gesture 'type' -
574 if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) {
evaluated: !(it.value() & Qt::DontStartGestureOnChildren)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
partially evaluated: w != widget
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
575 // conflicting gesture! -
576 (*conflicts)[widget].append(gestures[widget]);
executed (the execution status of this line is deduced): (*conflicts)[widget].append(gestures[widget]);
-
577 break;
executed: break;
Execution Count:12
12
578 } -
579 }
executed: }
Execution Count:2
2
580 if (w->isWindow()) {
evaluated: w->isWindow()
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:6
6-50
581 w = 0;
executed (the execution status of this line is deduced): w = 0;
-
582 break;
executed: break;
Execution Count:50
50
583 } -
584 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
585 }
executed: }
Execution Count:6
6
586 if (!w)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:12
12-66
587 (*normal)[widget].append(gestures[widget]);
executed: (*normal)[widget].append(gestures[widget]);
Execution Count:66
66
588 }
executed: }
Execution Count:78
78
589 }
executed: }
Execution Count:78
78
590}
executed: }
Execution Count:245
245
591 -
592void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, -
593 QSet<QGesture *> *undeliveredGestures) -
594{ -
595 if (gestures.isEmpty())
evaluated: gestures.isEmpty()
TRUEFALSE
yes
Evaluation Count:116
yes
Evaluation Count:245
116-245
596 return;
executed: return;
Execution Count:116
116
597 -
598 typedef QHash<QWidget *, QList<QGesture *> > GesturesPerWidget;
executed (the execution status of this line is deduced): typedef QHash<QWidget *, QList<QGesture *> > GesturesPerWidget;
-
599 GesturesPerWidget conflictedGestures;
executed (the execution status of this line is deduced): GesturesPerWidget conflictedGestures;
-
600 GesturesPerWidget normalStartedGestures;
executed (the execution status of this line is deduced): GesturesPerWidget normalStartedGestures;
-
601 -
602 QSet<QGesture *> startedGestures;
executed (the execution status of this line is deduced): QSet<QGesture *> startedGestures;
-
603 // first figure out the initial receivers of gestures -
604 for (QSet<QGesture *>::const_iterator it = gestures.begin(),
executed (the execution status of this line is deduced): for (QSet<QGesture *>::const_iterator it = gestures.begin(),
-
605 e = gestures.end(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:289
yes
Evaluation Count:245
245-289
606 QGesture *gesture = *it;
executed (the execution status of this line is deduced): QGesture *gesture = *it;
-
607 QWidget *target = m_gestureTargets.value(gesture, 0);
executed (the execution status of this line is deduced): QWidget *target = m_gestureTargets.value(gesture, 0);
-
608 if (!target) {
evaluated: !target
TRUEFALSE
yes
Evaluation Count:84
yes
Evaluation Count:205
84-205
609 // the gesture has just started and doesn't have a target yet. -
610 Q_ASSERT(gesture->state() == Qt::GestureStarted);
executed (the execution status of this line is deduced): qt_noop();
-
611 if (gesture->hasHotSpot()) {
evaluated: gesture->hasHotSpot()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:39
39-45
612 // guess the target widget using the hotspot of the gesture -
613 QPoint pt = gesture->hotSpot().toPoint();
executed (the execution status of this line is deduced): QPoint pt = gesture->hotSpot().toPoint();
-
614 if (QWidget *topLevel = qApp->topLevelAt(pt)) {
evaluated: QWidget *topLevel = (static_cast<QApplication *>(QCoreApplication::instance()))->topLevelAt(pt)
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:5
5-40
615 QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
executed (the execution status of this line is deduced): QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
-
616 target = child ? child : topLevel;
evaluated: child
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:2
2-38
617 }
executed: }
Execution Count:40
40
618 } else {
executed: }
Execution Count:45
45
619 // or use the context of the gesture -
620 QObject *context = m_gestureOwners.value(gesture, 0);
executed (the execution status of this line is deduced): QObject *context = m_gestureOwners.value(gesture, 0);
-
621 if (context->isWidgetType())
evaluated: context->isWidgetType()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:4
4-35
622 target = static_cast<QWidget *>(context);
executed: target = static_cast<QWidget *>(context);
Execution Count:35
35
623 }
executed: }
Execution Count:39
39
624 if (target)
evaluated: target
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:9
9-75
625 m_gestureTargets.insert(gesture, target);
executed: m_gestureTargets.insert(gesture, target);
Execution Count:75
75
626 }
executed: }
Execution Count:84
84
627 -
628 Qt::GestureType gestureType = gesture->gestureType();
executed (the execution status of this line is deduced): Qt::GestureType gestureType = gesture->gestureType();
-
629 Q_ASSERT(gestureType != Qt::CustomGesture);
executed (the execution status of this line is deduced): qt_noop();
-
630 Q_UNUSED(gestureType);
executed (the execution status of this line is deduced): (void)gestureType;;
-
631 -
632 if (target) {
evaluated: target
TRUEFALSE
yes
Evaluation Count:280
yes
Evaluation Count:9
9-280
633 if (gesture->state() == Qt::GestureStarted) {
evaluated: gesture->state() == Qt::GestureStarted
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:202
78-202
634 startedGestures.insert(gesture);
executed (the execution status of this line is deduced): startedGestures.insert(gesture);
-
635 } else {
executed: }
Execution Count:78
78
636 normalStartedGestures[target].append(gesture);
executed (the execution status of this line is deduced): normalStartedGestures[target].append(gesture);
-
637 }
executed: }
Execution Count:202
202
638 } else { -
639 DEBUG() << "QGestureManager::deliverEvent: could not find the target for gesture"
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 639, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType();
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
640 << gesture->gestureType();
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 639, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType();
0
641 qWarning("QGestureManager::deliverEvent: could not find the target for gesture");
executed (the execution status of this line is deduced): QMessageLogger("kernel/qgesturemanager.cpp", 641, __PRETTY_FUNCTION__).warning("QGestureManager::deliverEvent: could not find the target for gesture");
-
642 undeliveredGestures->insert(gesture);
executed (the execution status of this line is deduced): undeliveredGestures->insert(gesture);
-
643 }
executed: }
Execution Count:9
9
644 } -
645 -
646 getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);
executed (the execution status of this line is deduced): getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);
-
647 DEBUG() << "QGestureManager::deliverEvents:"
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 647, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:245
0-245
648 << "\nstarted: " << startedGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 647, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
649 << "\nconflicted: " << conflictedGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 647, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
650 << "\nnormal: " << normalStartedGestures
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 647, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
651 << "\n";
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 647, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
652 -
653 // if there are conflicting gestures, send the GestureOverride event -
654 for (GesturesPerWidget::const_iterator it = conflictedGestures.constBegin(),
executed (the execution status of this line is deduced): for (GesturesPerWidget::const_iterator it = conflictedGestures.constBegin(),
-
655 e = conflictedGestures.constEnd(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:245
10-245
656 QWidget *receiver = it.key();
executed (the execution status of this line is deduced): QWidget *receiver = it.key();
-
657 QList<QGesture *> gestures = it.value();
executed (the execution status of this line is deduced): QList<QGesture *> gestures = it.value();
-
658 DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to"
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 658, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
659 << receiver
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 658, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures;
0
660 << "gestures:" << gestures;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 658, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures;
0
661 QGestureEvent event(gestures);
executed (the execution status of this line is deduced): QGestureEvent event(gestures);
-
662 event.t = QEvent::GestureOverride;
executed (the execution status of this line is deduced): event.t = QEvent::GestureOverride;
-
663 // mark event and individual gestures as ignored -
664 event.ignore();
executed (the execution status of this line is deduced): event.ignore();
-
665 foreach(QGesture *g, gestures)
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
666 event.setAccepted(g, false);
executed: event.setAccepted(g, false);
Execution Count:12
12
667 -
668 QApplication::sendEvent(receiver, &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(receiver, &event);
-
669 bool eventAccepted = event.isAccepted();
executed (the execution status of this line is deduced): bool eventAccepted = event.isAccepted();
-
670 foreach(QGesture *gesture, event.gestures()) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(event.gestures())> _container_(event.gestures()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
671 if (eventAccepted || event.isAccepted(gesture)) {
partially evaluated: eventAccepted
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
evaluated: event.isAccepted(gesture)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:9
0-12
672 QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
executed (the execution status of this line is deduced): QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
-
673 Q_ASSERT(w);
executed (the execution status of this line is deduced): qt_noop();
-
674 DEBUG() << "override event: gesture was accepted:" << gesture << w;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 674, __PRETTY_FUNCTION__).debug() << "override event: gesture was accepted:" << gesture << w;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
675 QList<QGesture *> &gestures = normalStartedGestures[w];
executed (the execution status of this line is deduced): QList<QGesture *> &gestures = normalStartedGestures[w];
-
676 gestures.append(gesture);
executed (the execution status of this line is deduced): gestures.append(gesture);
-
677 // override the target -
678 m_gestureTargets[gesture] = w;
executed (the execution status of this line is deduced): m_gestureTargets[gesture] = w;
-
679 } else {
executed: }
Execution Count:3
3
680 DEBUG() << "override event: gesture wasn't accepted. putting back:" << gesture;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 680, __PRETTY_FUNCTION__).debug() << "override event: gesture wasn't accepted. putting back:" << gesture;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
681 QList<QGesture *> &gestures = normalStartedGestures[receiver];
executed (the execution status of this line is deduced): QList<QGesture *> &gestures = normalStartedGestures[receiver];
-
682 gestures.append(gesture);
executed (the execution status of this line is deduced): gestures.append(gesture);
-
683 }
executed: }
Execution Count:9
9
684 } -
685 }
executed: }
Execution Count:10
10
686 -
687 // delivering gestures that are not in conflicted state -
688 for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
executed (the execution status of this line is deduced): for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
-
689 e = normalStartedGestures.constEnd(); it != e; ++it) {
evaluated: it != e
TRUEFALSE
yes
Evaluation Count:258
yes
Evaluation Count:245
245-258
690 if (!it.value().isEmpty()) {
partially evaluated: !it.value().isEmpty()
TRUEFALSE
yes
Evaluation Count:258
no
Evaluation Count:0
0-258
691 DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key()
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 691, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents: sending to" << it.key() << "gestures:" << it.value();
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:258
0-258
692 << "gestures:" << it.value();
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 691, __PRETTY_FUNCTION__).debug() << "QGestureManager::deliverEvents: sending to" << it.key() << "gestures:" << it.value();
0
693 QGestureEvent event(it.value());
executed (the execution status of this line is deduced): QGestureEvent event(it.value());
-
694 QApplication::sendEvent(it.key(), &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(it.key(), &event);
-
695 bool eventAccepted = event.isAccepted();
executed (the execution status of this line is deduced): bool eventAccepted = event.isAccepted();
-
696 foreach (QGesture *gesture, event.gestures()) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(event.gestures())> _container_(event.gestures()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
697 if (gesture->state() == Qt::GestureStarted &&
evaluated: gesture->state() == Qt::GestureStarted
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:203
77-203
698 (eventAccepted || event.isAccepted(gesture))) {
partially evaluated: eventAccepted
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77
evaluated: event.isAccepted(gesture)
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:13
0-77
699 QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
executed (the execution status of this line is deduced): QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
-
700 Q_ASSERT(w);
executed (the execution status of this line is deduced): qt_noop();
-
701 DEBUG() << "started gesture was delivered and accepted by" << w;
never executed: QMessageLogger("kernel/qgesturemanager.cpp", 701, __PRETTY_FUNCTION__).debug() << "started gesture was delivered and accepted by" << w;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:64
0-64
702 m_gestureTargets[gesture] = w;
executed (the execution status of this line is deduced): m_gestureTargets[gesture] = w;
-
703 }
executed: }
Execution Count:64
64
704 }
executed: }
Execution Count:280
280
705 }
executed: }
Execution Count:258
258
706 }
executed: }
Execution Count:258
258
707}
executed: }
Execution Count:245
245
708 -
709void QGestureManager::recycle(QGesture *gesture) -
710{ -
711 QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0);
executed (the execution status of this line is deduced): QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0);
-
712 if (recognizer) {
partially evaluated: recognizer
TRUEFALSE
yes
Evaluation Count:87
no
Evaluation Count:0
0-87
713 gesture->setGestureCancelPolicy(QGesture::CancelNone);
executed (the execution status of this line is deduced): gesture->setGestureCancelPolicy(QGesture::CancelNone);
-
714 recognizer->reset(gesture);
executed (the execution status of this line is deduced): recognizer->reset(gesture);
-
715 m_activeGestures.remove(gesture);
executed (the execution status of this line is deduced): m_activeGestures.remove(gesture);
-
716 } else {
executed: }
Execution Count:87
87
717 cleanupGesturesForRemovedRecognizer(gesture);
never executed (the execution status of this line is deduced): cleanupGesturesForRemovedRecognizer(gesture);
-
718 }
never executed: }
0
719} -
720 -
721QT_END_NAMESPACE -
722 -
723#endif // QT_NO_GESTURES -
724 -
725#include "moc_qgesturemanager_p.cpp" -
726 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial