qgesturemanager.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qgesturemanager.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6const QLoggingCategory &lcGestureManager() { static const QLoggingCategory category("qt.widgets.gestures"); return
never executed: return category;
category;
never executed: return category;
}
0
7-
8-
9static inline int panTouchPoints()-
10{-
11-
12 static const char panTouchPointVariable[] = "QT_PAN_TOUCHPOINTS";-
13 if (qEnvironmentVariableIsSet(panTouchPointVariable)
qEnvironmentVa...PointVariable)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
14 bool ok;-
15 const int result = qEnvironmentVariableIntValue(panTouchPointVariable, &ok);-
16 if (ok
okDescription
TRUEnever evaluated
FALSEnever evaluated
&& result >= 1
result >= 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
17 return
never executed: return result;
result;
never executed: return result;
0
18 QMessageLogger(__FILE__, 78, __PRETTY_FUNCTION__).warning() << "Ignoring invalid value of " << panTouchPointVariable;-
19 }
never executed: end of block
0
20-
21-
22-
23-
24 return
never executed: return 2;
2;
never executed: return 2;
0
25}-
26-
27-
28QGestureManager::QGestureManager(QObject *parent)-
29 : QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture)-
30{-
31 qRegisterMetaType<Qt::GestureState>();-
32-
33-
34-
35-
36-
37-
38 registerGestureRecognizer(new QPanGestureRecognizer(panTouchPoints()));-
39 registerGestureRecognizer(new QPinchGestureRecognizer);-
40 registerGestureRecognizer(new QSwipeGestureRecognizer);-
41 registerGestureRecognizer(new QTapGestureRecognizer);-
42-
43-
44-
45-
46-
47-
48-
49 registerGestureRecognizer(new QTapAndHoldGestureRecognizer);-
50-
51}
never executed: end of block
0
52-
53QGestureManager::~QGestureManager()-
54{-
55 qDeleteAll(m_recognizers);-
56 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_obsoleteGestures.keys())>::type> _container_((m_obsoleteGestures.keys())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGestureRecognizer *recognizer = *_container_.i; _container_.control; _container_.control = 0) {-
57 qDeleteAll(m_obsoleteGestures.value(recognizer));-
58 delete recognizer;-
59 }
never executed: end of block
0
60 m_obsoleteGestures.clear();-
61}
never executed: end of block
0
62-
63Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer)-
64{-
65 QGesture *dummy = recognizer->create(0);-
66 if (__builtin_expect(!!(!dummy), false)
__builtin_expe...dummy), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
67 QMessageLogger(__FILE__, 127, __PRETTY_FUNCTION__).warning("QGestureManager::registerGestureRecognizer: "-
68 "the recognizer fails to create a gesture object, skipping registration.");-
69 return
never executed: return Qt::GestureType(0);
Qt::GestureType(0);
never executed: return Qt::GestureType(0);
0
70 }-
71 Qt::GestureType type = dummy->gestureType();-
72 if (type == Qt::CustomGesture
type == Qt::CustomGestureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
73-
74 ++m_lastCustomGestureId;-
75 type = Qt::GestureType(m_lastCustomGestureId);-
76 }
never executed: end of block
0
77 m_recognizers.insertMulti(type, recognizer);-
78 delete dummy;-
79 return
never executed: return type;
type;
never executed: return type;
0
80}-
81-
82void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)-
83{-
84 QList<QGestureRecognizer *> list = m_recognizers.values(type);-
85 while (QGestureRecognizer *recognizer = m_recognizers.take(type)
QGestureRecogn...ers.take(type)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
86 if (!m_obsoleteGestures.contains(recognizer)
!m_obsoleteGes...ns(recognizer)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
87-
88 m_obsoleteGestures.insert(recognizer, QSet<QGesture *>());-
89 }
never executed: end of block
0
90 }
never executed: end of block
0
91 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_gestureToRecognizer.keys())>::type> _container_((m_gestureToRecognizer.keys())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) {-
92 QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);-
93 if (list.contains(recognizer)
list.contains(recognizer)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
94 m_deletedRecognizers.insert(g, recognizer);-
95 }
never executed: end of block
0
96 }
never executed: end of block
0
97-
98 QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.constBegin();-
99 while (iter != m_objectGestures.constEnd()
iter != m_obje...res.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
100 ObjectGesture objectGesture = iter.key();-
101 if (objectGesture.gesture == type
objectGesture.gesture == typeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
102 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(iter.value())>::type> _container_((iter.value())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) {-
103 if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g)
QGestureRecogn...nizer.value(g)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
104 m_gestureToRecognizer.remove(g);-
105 m_obsoleteGestures[recognizer].insert(g);-
106 }
never executed: end of block
0
107 }
never executed: end of block
0
108 }
never executed: end of block
0
109 ++iter;-
110 }
never executed: end of block
0
111}
never executed: end of block
0
112-
113void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType type)-
114{-
115 QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();-
116 while (iter != m_objectGestures.end()
iter != m_objectGestures.end()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
117 ObjectGesture objectGesture = iter.key();-
118 if (objectGesture.gesture == type
objectGesture.gesture == typeDescription
TRUEnever evaluated
FALSEnever evaluated
&& target == objectGesture.object
target == objectGesture.objectDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
119 QSet<QGesture *> gestures = iter.value().toSet();-
120 for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator-
121 it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
122 it.value() -= gestures;-
123 }
never executed: end of block
0
124 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) {-
125 m_deletedRecognizers.remove(g);-
126 m_gestureToRecognizer.remove(g);-
127 m_maybeGestures.remove(g);-
128 m_activeGestures.remove(g);-
129 m_gestureOwners.remove(g);-
130 m_gestureTargets.remove(g);-
131 m_gesturesToDelete.insert(g);-
132 }
never executed: end of block
0
133-
134 iter = m_objectGestures.erase(iter);-
135 }
never executed: end of block
else {
0
136 ++iter;-
137 }
never executed: end of block
0
138 }-
139}
never executed: end of block
0
140-
141-
142QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type)-
143{-
144-
145-
146-
147 if (object->isWidgetType()
object->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
148 if (static_cast<
static_cast<QW....in_destructorDescription
TRUEnever evaluated
FALSEnever evaluated
QWidget *>(object)->d_func()->data.in_destructor
static_cast<QW....in_destructorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
149 return
never executed: return 0;
0;
never executed: return 0;
0
150 }
never executed: end of block
else if (QGesture *g = qobject_cast<QGesture *>(object)
QGesture *g = ...ure *>(object)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
151 return
never executed: return g;
g;
never executed: return g;
0
152-
153 } else {-
154 ((!(qobject_cast<QGraphicsObject *>(object))) ? qt_assert("qobject_cast<QGraphicsObject *>(object)",__FILE__,214) : qt_noop());-
155 QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);-
156 if (graphicsObject->QGraphicsItem::d_func()->inDestructor
graphicsObject...->inDestructorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
157 return
never executed: return 0;
0;
never executed: return 0;
0
158-
159 }
never executed: end of block
0
160-
161-
162 const auto states = m_objectGestures.value(QGestureManager::ObjectGesture(object, type));-
163 for (QGesture *state : states) {-
164 if (m_gestureToRecognizer.value(state) == recognizer
m_gestureToRec... == recognizerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
165 return
never executed: return state;
state;
never executed: return state;
0
166 }
never executed: end of block
0
167-
168 ((!(recognizer)) ? qt_assert("recognizer",__FILE__,228) : qt_noop());-
169 QGesture *state = recognizer->create(object);-
170 if (!state
!stateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
171 return
never executed: return 0;
0;
never executed: return 0;
0
172 state->setParent(this);-
173 if (state->gestureType() == Qt::CustomGesture
state->gesture...:CustomGestureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
174-
175-
176 state->d_func()->gestureType = type;-
177 if (lcGestureManager().isDebugEnabled()
lcGestureManag...DebugEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
178 state->setObjectName(QString::number((int)type));
never executed: state->setObjectName(QString::number((int)type));
0
179 }
never executed: end of block
0
180 m_objectGestures[QGestureManager::ObjectGesture(object, type)].append(state);-
181 m_gestureToRecognizer[state] = recognizer;-
182 m_gestureOwners[state] = object;-
183-
184 return
never executed: return state;
state;
never executed: return state;
0
185}-
186-
187bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,-
188 Qt::GestureType> &contexts,-
189 QEvent *event)-
190{-
191 QSet<QGesture *> triggeredGestures;-
192 QSet<QGesture *> finishedGestures;-
193 QSet<QGesture *> newMaybeGestures;-
194 QSet<QGesture *> notGestures;-
195-
196-
197-
198-
199 bool consumeEventHint = false;-
200-
201-
202 typedef QMultiMap<QObject *, Qt::GestureType>::const_iterator ContextIterator;-
203 ContextIterator contextEnd = contexts.end();-
204 for (ContextIterator context = contexts.begin(); context != contextEnd
context != contextEndDescription
TRUEnever evaluated
FALSEnever evaluated
; ++context) {
0
205 Qt::GestureType gestureType = context.value();-
206 const QMap<Qt::GestureType, QGestureRecognizer *> &const_recognizers = m_recognizers;-
207 QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator-
208 typeToRecognizerIterator = const_recognizers.lowerBound(gestureType),-
209 typeToRecognizerEnd = const_recognizers.upperBound(gestureType);-
210 for (; typeToRecognizerIterator != typeToRecognizerEnd
typeToRecogniz...oRecognizerEndDescription
TRUEnever evaluated
FALSEnever evaluated
; ++typeToRecognizerIterator) {
0
211 QGestureRecognizer *recognizer = typeToRecognizerIterator.value();-
212 QObject *target = context.key();-
213 QGesture *state = getState(target, recognizer, gestureType);-
214 if (!state
!stateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
215 continue;
never executed: continue;
0
216 QGestureRecognizer::Result recognizerResult = recognizer->recognize(state, target, event);-
217 QGestureRecognizer::Result recognizerState = recognizerResult & QGestureRecognizer::ResultState_Mask;-
218 QGestureRecognizer::Result resultHint = recognizerResult & QGestureRecognizer::ResultHint_Mask;-
219 if (recognizerState == QGestureRecognizer::TriggerGesture
recognizerStat...TriggerGestureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
220 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 280, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: gesture triggered: " << state << event;
never executed: QMessageLogger(__FILE__, 280, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: gesture triggered: " << state << event;
0
221 triggeredGestures << state;-
222 }
never executed: end of block
else if (recognizerState == QGestureRecognizer::FinishGesture
recognizerStat...:FinishGestureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
223 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 283, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: gesture finished: " << state << event;
never executed: QMessageLogger(__FILE__, 283, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: gesture finished: " << state << event;
0
224 finishedGestures << state;-
225 }
never executed: end of block
else if (recognizerState == QGestureRecognizer::MayBeGesture
recognizerStat...::MayBeGestureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
226 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 286, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: maybe gesture: " << state << event;
never executed: QMessageLogger(__FILE__, 286, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: maybe gesture: " << state << event;
0
227 newMaybeGestures << state;-
228 }
never executed: end of block
else if (recognizerState == QGestureRecognizer::CancelGesture
recognizerStat...:CancelGestureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
229 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 289, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: not gesture: " << state << event;
never executed: QMessageLogger(__FILE__, 289, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: not gesture: " << state << event;
0
230 notGestures << state;-
231 }
never executed: end of block
else if (recognizerState == QGestureRecognizer::Ignore
recognizerStat...gnizer::IgnoreDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
232 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 292, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: ignored the event: " << state << event;
never executed: QMessageLogger(__FILE__, 292, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: ignored the event: " << state << event;
0
233 }
never executed: end of block
else {
0
234 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 294, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: hm, lets assume the recognizer"
never executed: QMessageLogger(__FILE__, 294, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: hm, lets assume the recognizer" << "ignored the event: " << state << event;
0
235 << "ignored the event: " << state << event;
never executed: QMessageLogger(__FILE__, 294, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager:Recognizer: hm, lets assume the recognizer" << "ignored the event: " << state << event;
0
236 }
never executed: end of block
0
237 if (resultHint & QGestureRecognizer::ConsumeEventHint
resultHint & Q...nsumeEventHintDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
238 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 298, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager: we were asked to consume the event: "
never executed: QMessageLogger(__FILE__, 298, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager: we were asked to consume the event: " << state << event;
0
239 << state << event;
never executed: QMessageLogger(__FILE__, 298, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager: we were asked to consume the event: " << state << event;
0
240 consumeEventHint = true;-
241 }
never executed: end of block
0
242 }
never executed: end of block
0
243 }
never executed: end of block
0
244 if (!triggeredGestures.isEmpty()
!triggeredGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !finishedGestures.isEmpty()
!finishedGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
245 || !newMaybeGestures.isEmpty()
!newMaybeGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !notGestures.isEmpty()
!notGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
246 QSet<QGesture *> startedGestures = triggeredGestures - m_activeGestures;-
247 triggeredGestures &= m_activeGestures;-
248-
249-
250 QSet<QGesture *> activeToMaybeGestures = m_activeGestures & newMaybeGestures;-
251-
252-
253 QSet<QGesture *> maybeToCanceledGestures = m_maybeGestures & notGestures;-
254-
255-
256-
257 QSet<QGesture *> canceledGestures = m_activeGestures & notGestures;-
258-
259-
260 m_maybeGestures += newMaybeGestures;-
261-
262-
263 QSet<QGesture *> notMaybeGestures = (startedGestures | triggeredGestures-
264 | finishedGestures | canceledGestures-
265 | notGestures);-
266 m_maybeGestures -= notMaybeGestures;-
267-
268 ((!((startedGestures & finishedGestures).isEmpty())) ? qt_assert("(startedGestures & finishedGestures).isEmpty()",__FILE__,328) : qt_noop());-
269 ((!((startedGestures & newMaybeGestures).isEmpty())) ? qt_assert("(startedGestures & newMaybeGestures).isEmpty()",__FILE__,329) : qt_noop());-
270 ((!((startedGestures & canceledGestures).isEmpty())) ? qt_assert("(startedGestures & canceledGestures).isEmpty()",__FILE__,330) : qt_noop());-
271 ((!((finishedGestures & newMaybeGestures).isEmpty())) ? qt_assert("(finishedGestures & newMaybeGestures).isEmpty()",__FILE__,331) : qt_noop());-
272 ((!((finishedGestures & canceledGestures).isEmpty())) ? qt_assert("(finishedGestures & canceledGestures).isEmpty()",__FILE__,332) : qt_noop());-
273 ((!((canceledGestures & newMaybeGestures).isEmpty())) ? qt_assert("(canceledGestures & newMaybeGestures).isEmpty()",__FILE__,333) : qt_noop());-
274-
275 QSet<QGesture *> notStarted = finishedGestures - m_activeGestures;-
276 if (!notStarted.isEmpty()
!notStarted.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
277-
278-
279 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(notStarted)>::type> _container_((notStarted)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0)-
280 gesture->d_func()->state = Qt::GestureStarted;
never executed: gesture->d_func()->state = Qt::GestureStarted;
0
281 QSet<QGesture *> undeliveredGestures;-
282 deliverEvents(notStarted, &undeliveredGestures);-
283 finishedGestures -= undeliveredGestures;-
284 }
never executed: end of block
0
285-
286 m_activeGestures += startedGestures;-
287-
288 ((!((m_activeGestures & triggeredGestures).size() == triggeredGestures.size())) ? qt_assert("(m_activeGestures & triggeredGestures).size() == triggeredGestures.size()",__FILE__,348) : qt_noop());-
289 m_activeGestures -= finishedGestures;-
290 m_activeGestures -= activeToMaybeGestures;-
291 m_activeGestures -= canceledGestures;-
292-
293-
294 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(startedGestures)>::type> _container_((startedGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0)-
295 gesture->d_func()->state = Qt::GestureStarted;
never executed: gesture->d_func()->state = Qt::GestureStarted;
0
296 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(triggeredGestures)>::type> _container_((triggeredGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0)-
297 gesture->d_func()->state = Qt::GestureUpdated;
never executed: gesture->d_func()->state = Qt::GestureUpdated;
0
298 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(finishedGestures)>::type> _container_((finishedGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0)-
299 gesture->d_func()->state = Qt::GestureFinished;
never executed: gesture->d_func()->state = Qt::GestureFinished;
0
300 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(canceledGestures)>::type> _container_((canceledGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0)-
301 gesture->d_func()->state = Qt::GestureCanceled;
never executed: gesture->d_func()->state = Qt::GestureCanceled;
0
302 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(activeToMaybeGestures)>::type> _container_((activeToMaybeGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0)-
303 gesture->d_func()->state = Qt::GestureFinished;
never executed: gesture->d_func()->state = Qt::GestureFinished;
0
304-
305 if (!m_activeGestures.isEmpty()
!m_activeGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !m_maybeGestures.isEmpty()
!m_maybeGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
306 !startedGestures.isEmpty()
!startedGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !triggeredGestures.isEmpty()
!triggeredGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
307 !finishedGestures.isEmpty()
!finishedGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !canceledGestures.isEmpty()
!canceledGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
308 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::filterEventThroughContexts:"
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
309 << "\n\tactiveGestures:" << m_activeGestures
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
310 << "\n\tmaybeGestures:" << m_maybeGestures
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
311 << "\n\tstarted:" << startedGestures
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
312 << "\n\ttriggered:" << triggeredGestures
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
313 << "\n\tfinished:" << finishedGestures
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
314 << "\n\tcanceled:" << canceledGestures
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
315 << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
never executed: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).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
316 }
never executed: end of block
0
317-
318 QSet<QGesture *> undeliveredGestures;-
319 deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures,-
320 &undeliveredGestures);-
321-
322 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(startedGestures)>::type> _container_((startedGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) {-
323 if (undeliveredGestures.contains(g)
undeliveredGes...es.contains(g)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
324 continue;
never executed: continue;
0
325 if (g->gestureCancelPolicy() == QGesture::CancelAllInContext
g->gestureCanc...elAllInContextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
326 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 386, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "lets try to cancel some";
never executed: QMessageLogger(__FILE__, 386, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "lets try to cancel some";
0
327-
328 cancelGesturesForChildren(g);-
329 }
never executed: end of block
0
330 }
never executed: end of block
0
331-
332 m_activeGestures -= undeliveredGestures;-
333-
334-
335 QSet<QGesture *> endedGestures =-
336 finishedGestures + canceledGestures + undeliveredGestures + maybeToCanceledGestures;-
337 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(endedGestures)>::type> _container_((endedGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0) {-
338 recycle(gesture);-
339 m_gestureTargets.remove(gesture);-
340 }
never executed: end of block
0
341 }
never executed: end of block
0
342-
343 qDeleteAll(m_gesturesToDelete);-
344 m_gesturesToDelete.clear();-
345-
346 return
never executed: return consumeEventHint;
consumeEventHint;
never executed: return consumeEventHint;
0
347}-
348-
349-
350void QGestureManager::cancelGesturesForChildren(QGesture *original)-
351{-
352 ((!(original)) ? qt_assert("original",__FILE__,412) : qt_noop());-
353 QWidget *originatingWidget = m_gestureTargets.value(original);-
354 ((!(originatingWidget)) ? qt_assert("originatingWidget",__FILE__,414) : qt_noop());-
355 if (!originatingWidget
!originatingWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
356 return;
never executed: return;
0
357-
358-
359-
360-
361-
362 QSet<QGesture*> cancelledGestures;-
363 QSet<QGesture*>::Iterator iter = m_activeGestures.begin();-
364 while (iter != m_activeGestures.end()
iter != m_activeGestures.end()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
365 QWidget *widget = m_gestureTargets.value(*iter);-
366-
367 if (widget != originatingWidget
widget != originatingWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& originatingWidget->isAncestorOf(widget)
originatingWid...storOf(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
368 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 428, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << " found a gesture to cancel" << (*iter);
never executed: QMessageLogger(__FILE__, 428, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << " found a gesture to cancel" << (*iter);
0
369 (*iter)->d_func()->state = Qt::GestureCanceled;-
370 cancelledGestures << *iter;-
371 iter = m_activeGestures.erase(iter);-
372 }
never executed: end of block
else {
0
373 ++iter;-
374 }
never executed: end of block
0
375 }-
376-
377-
378-
379-
380 QSet<QGesture *> almostCanceledGestures = cancelledGestures;-
381 while (!almostCanceledGestures.isEmpty()
!almostCancele...ures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
382 QWidget *target = 0;-
383 QSet<QGesture*> gestures;-
384 iter = almostCanceledGestures.begin();-
385-
386 while (iter != almostCanceledGestures.end()
iter != almost...Gestures.end()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
387 QWidget *widget = m_gestureTargets.value(*iter);-
388 if (target == 0
target == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
389 target = widget;
never executed: target = widget;
0
390 if (target == widget
target == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
391 gestures << *iter;-
392 iter = almostCanceledGestures.erase(iter);-
393 }
never executed: end of block
else {
0
394 ++iter;-
395 }
never executed: end of block
0
396 }-
397 ((!(target)) ? qt_assert("target",__FILE__,457) : qt_noop());-
398-
399 QSet<QGesture*> undeliveredGestures;-
400 deliverEvents(gestures, &undeliveredGestures);-
401 }
never executed: end of block
0
402-
403 for (iter = cancelledGestures.begin(); iter != cancelledGestures.end()
iter != cancel...Gestures.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++iter)
0
404 recycle(*iter);
never executed: recycle(*iter);
0
405}
never executed: end of block
0
406-
407void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture)-
408{-
409 QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture);-
410 if(!recognizer
!recognizerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
411 return;
never executed: return;
0
412 m_deletedRecognizers.remove(gesture);-
413 if (m_deletedRecognizers.keys(recognizer).isEmpty()
m_deletedRecog...zer).isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
414-
415 qDeleteAll(m_obsoleteGestures.value(recognizer));-
416 m_obsoleteGestures.remove(recognizer);-
417 delete recognizer;-
418 }
never executed: end of block
0
419}
never executed: end of block
0
420-
421-
422bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)-
423{-
424 QMap<Qt::GestureType, int> types;-
425 QMultiMap<QObject *, Qt::GestureType> contexts;-
426 QWidget *w = receiver;-
427 typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;-
428 if (!w->d_func()->gestureContext.isEmpty()
!w->d_func()->...text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
429 for(ContextIterator it = w->d_func()->gestureContext.constBegin(),-
430 e = w->d_func()->gestureContext.constEnd(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
431 types.insert(it.key(), 0);-
432 contexts.insertMulti(w, it.key());-
433 }
never executed: end of block
0
434 }
never executed: end of block
0
435-
436 w = w->isWindow()
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : w->parentWidget();
0
437 while (w
wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
438 {-
439 for (ContextIterator it = w->d_func()->gestureContext.constBegin(),-
440 e = w->d_func()->gestureContext.constEnd(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
441 if (!(it.value() & Qt::DontStartGestureOnChildren)
!(it.value() &...ureOnChildren)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
442 if (!types.contains(it.key())
!types.contains(it.key())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
443 types.insert(it.key(), 0);-
444 contexts.insertMulti(w, it.key());-
445 }
never executed: end of block
0
446 }
never executed: end of block
0
447 }
never executed: end of block
0
448 if (w->isWindow()
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
449 break;
never executed: break;
0
450 w = w->parentWidget();-
451 }
never executed: end of block
0
452 return
never executed: return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
never executed: return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
0
453}-
454-
455-
456bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)-
457{-
458 QMap<Qt::GestureType, int> types;-
459 QMultiMap<QObject *, Qt::GestureType> contexts;-
460 QGraphicsObject *item = receiver;-
461 if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()
!item->QGraphi...text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
462 typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;-
463 for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),-
464 e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
465 types.insert(it.key(), 0);-
466 contexts.insertMulti(item, it.key());-
467 }
never executed: end of block
0
468 }
never executed: end of block
0
469-
470 item = item->parentObject();-
471 while (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
472 {-
473 typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;-
474 for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),-
475 e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
476 if (!(it.value() & Qt::DontStartGestureOnChildren)
!(it.value() &...ureOnChildren)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
477 if (!types.contains(it.key())
!types.contains(it.key())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
478 types.insert(it.key(), 0);-
479 contexts.insertMulti(item, it.key());-
480 }
never executed: end of block
0
481 }
never executed: end of block
0
482 }
never executed: end of block
0
483 item = item->parentObject();-
484 }
never executed: end of block
0
485 return
never executed: return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
never executed: return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
0
486}-
487-
488-
489bool QGestureManager::filterEvent(QObject *receiver, QEvent *event)-
490{-
491-
492-
493 QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(receiver);-
494-
495 if (widgetWindow
widgetWindowDescription
TRUEnever evaluated
FALSEnever evaluated
&& widgetWindow->widget()
widgetWindow->widget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
496 return
never executed: return filterEvent(widgetWindow->widget(), event);
filterEvent(widgetWindow->widget(), event);
never executed: return filterEvent(widgetWindow->widget(), event);
0
497-
498 QGesture *state = qobject_cast<QGesture *>(receiver);-
499 if (!state
!stateDescription
TRUEnever evaluated
FALSEnever evaluated
|| !m_gestureToRecognizer.contains(state)
!m_gestureToRe...ontains(state)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
500 return
never executed: return false;
false;
never executed: return false;
0
501 QMultiMap<QObject *, Qt::GestureType> contexts;-
502 contexts.insert(state, state->gestureType());-
503 return
never executed: return filterEventThroughContexts(contexts, event);
filterEventThroughContexts(contexts, event);
never executed: return filterEventThroughContexts(contexts, event);
0
504}-
505-
506void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,-
507 QHash<QWidget *, QList<QGesture *> > *conflicts,-
508 QHash<QWidget *, QList<QGesture *> > *normal)-
509{-
510 typedef QHash<Qt::GestureType, QHash<QWidget *, QGesture *> > GestureByTypes;-
511 GestureByTypes gestureByTypes;-
512-
513-
514 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0) {-
515 QWidget *receiver = m_gestureTargets.value(gesture, 0);-
516 ((!(receiver)) ? qt_assert("receiver",__FILE__,576) : qt_noop());-
517 if (receiver
receiverDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
518 gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
never executed: gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
0
519 }
never executed: end of block
0
520-
521-
522 for (GestureByTypes::const_iterator git = gestureByTypes.cbegin(), gend = gestureByTypes.cend(); git != gend
git != gendDescription
TRUEnever evaluated
FALSEnever evaluated
; ++git) {
0
523 const QHash<QWidget *, QGesture *> &gestures = git.value();-
524 for (QHash<QWidget *, QGesture *>::const_iterator wit = gestures.cbegin(), wend = gestures.cend(); wit != wend
wit != wendDescription
TRUEnever evaluated
FALSEnever evaluated
; ++wit) {
0
525 QWidget *widget = wit.key();-
526 QWidget *w = widget->parentWidget();-
527 while (w
wDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
528 QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it-
529 = w->d_func()->gestureContext.constFind(git.key());-
530 if (it != w->d_func()->gestureContext.constEnd()
it != w->d_fun...ext.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
531-
532 if (!(it.value() & Qt::DontStartGestureOnChildren)
!(it.value() &...ureOnChildren)Description
TRUEnever evaluated
FALSEnever evaluated
&& w != widget
w != widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
533-
534 (*conflicts)[widget].append(wit.value());-
535 break;
never executed: break;
0
536 }-
537 }
never executed: end of block
0
538 if (w->isWindow()
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
539 w = 0;-
540 break;
never executed: break;
0
541 }-
542 w = w->parentWidget();-
543 }
never executed: end of block
0
544 if (!w
!wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
545 (*
never executed: (*normal)[widget].append(wit.value());
normal)[widget].append(wit.value());
never executed: (*normal)[widget].append(wit.value());
0
546 }
never executed: end of block
0
547 }
never executed: end of block
0
548}
never executed: end of block
0
549-
550void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,-
551 QSet<QGesture *> *undeliveredGestures)-
552{-
553 if (gestures.isEmpty()
gestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
554 return;
never executed: return;
0
555-
556 typedef QHash<QWidget *, QList<QGesture *> > GesturesPerWidget;-
557 GesturesPerWidget conflictedGestures;-
558 GesturesPerWidget normalStartedGestures;-
559-
560 QSet<QGesture *> startedGestures;-
561-
562 for (QSet<QGesture *>::const_iterator it = gestures.begin(),-
563 e = gestures.end(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
564 QGesture *gesture = *it;-
565 QWidget *target = m_gestureTargets.value(gesture, 0);-
566 if (!target
!targetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
567-
568 ((!(gesture->state() == Qt::GestureStarted)) ? qt_assert("gesture->state() == Qt::GestureStarted",__FILE__,628) : qt_noop());-
569 if (gesture->hasHotSpot()
gesture->hasHotSpot()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
570-
571 QPoint pt = gesture->hotSpot().toPoint();-
572 if (QWidget *topLevel = QApplication::topLevelAt(pt)
QWidget *topLe...topLevelAt(pt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
573 QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));-
574 target = child
childDescription
TRUEnever evaluated
FALSEnever evaluated
? child : topLevel;
0
575 }
never executed: end of block
0
576 }
never executed: end of block
else {
0
577-
578 QObject *context = m_gestureOwners.value(gesture, 0);-
579 if (context->isWidgetType()
context->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
580 target = static_cast<QWidget *>(context);
never executed: target = static_cast<QWidget *>(context);
0
581 }
never executed: end of block
0
582 if (target
targetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
583 m_gestureTargets.insert(gesture, target);
never executed: m_gestureTargets.insert(gesture, target);
0
584 }
never executed: end of block
0
585-
586 Qt::GestureType gestureType = gesture->gestureType();-
587 ((!(gestureType != Qt::CustomGesture)) ? qt_assert("gestureType != Qt::CustomGesture",__FILE__,647) : qt_noop());-
588 (void)gestureType;;-
589-
590 if (__builtin_expect(!!(!target), false)
__builtin_expe...arget), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
591 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 651, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvent: could not find the target for gesture"
never executed: QMessageLogger(__FILE__, 651, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType();
0
592 << gesture->gestureType();
never executed: QMessageLogger(__FILE__, 651, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType();
0
593 QMessageLogger(__FILE__, 653, __PRETTY_FUNCTION__).warning("QGestureManager::deliverEvent: could not find the target for gesture");-
594 undeliveredGestures->insert(gesture);-
595 }
never executed: end of block
else {
0
596 if (gesture->state() == Qt::GestureStarted
gesture->state...GestureStartedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
597 startedGestures.insert(gesture);-
598 }
never executed: end of block
else {
0
599 normalStartedGestures[target].append(gesture);-
600 }
never executed: end of block
0
601 }-
602 }-
603-
604 getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);-
605 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 665, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents:"
never executed: QMessageLogger(__FILE__, 665, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
606 << "\nstarted: " << startedGestures
never executed: QMessageLogger(__FILE__, 665, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
607 << "\nconflicted: " << conflictedGestures
never executed: QMessageLogger(__FILE__, 665, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
608 << "\nnormal: " << normalStartedGestures
never executed: QMessageLogger(__FILE__, 665, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
609 << "\n";
never executed: QMessageLogger(__FILE__, 665, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures << "\n";
0
610-
611-
612 for (GesturesPerWidget::const_iterator it = conflictedGestures.constBegin(),-
613 e = conflictedGestures.constEnd(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
614 QWidget *receiver = it.key();-
615 QList<QGesture *> gestures = it.value();-
616 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 676, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents: sending GestureOverride to"
never executed: QMessageLogger(__FILE__, 676, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures;
0
617 << receiver
never executed: QMessageLogger(__FILE__, 676, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures;
0
618 << "gestures:" << gestures;
never executed: QMessageLogger(__FILE__, 676, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures;
0
619 QGestureEvent event(gestures);-
620 event.t = QEvent::GestureOverride;-
621-
622 event.ignore();-
623 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0)-
624 event.setAccepted(g, false);
never executed: event.setAccepted(g, false);
0
625-
626 QApplication::sendEvent(receiver, &event);-
627 bool eventAccepted = event.isAccepted();-
628 const auto eventGestures = event.gestures();-
629 for (QGesture *gesture : eventGestures) {-
630 if (eventAccepted
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
|| event.isAccepted(gesture)
event.isAccepted(gesture)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
631 QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);-
632 ((!(w)) ? qt_assert("w",__FILE__,692) : qt_noop());-
633 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 693, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "override event: gesture was accepted:" << gesture << w;
never executed: QMessageLogger(__FILE__, 693, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "override event: gesture was accepted:" << gesture << w;
0
634 QList<QGesture *> &gestures = normalStartedGestures[w];-
635 gestures.append(gesture);-
636-
637 m_gestureTargets[gesture] = w;-
638 }
never executed: end of block
else {
0
639 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 699, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "override event: gesture wasn't accepted. putting back:" << gesture;
never executed: QMessageLogger(__FILE__, 699, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "override event: gesture wasn't accepted. putting back:" << gesture;
0
640 QList<QGesture *> &gestures = normalStartedGestures[receiver];-
641 gestures.append(gesture);-
642 }
never executed: end of block
0
643 }-
644 }
never executed: end of block
0
645-
646-
647 for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),-
648 e = normalStartedGestures.constEnd(); it != e
it != eDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
649 if (!it.value().isEmpty()
!it.value().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
650 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 710, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents: sending to" << it.key()
never executed: QMessageLogger(__FILE__, 710, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents: sending to" << it.key() << "gestures:" << it.value();
0
651 << "gestures:" << it.value();
never executed: QMessageLogger(__FILE__, 710, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "QGestureManager::deliverEvents: sending to" << it.key() << "gestures:" << it.value();
0
652 QGestureEvent event(it.value());-
653 QApplication::sendEvent(it.key(), &event);-
654 bool eventAccepted = event.isAccepted();-
655 const auto eventGestures = event.gestures();-
656 for (QGesture *gesture : eventGestures) {-
657 if (gesture->state() == Qt::GestureStarted
gesture->state...GestureStartedDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
658 (eventAccepted
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
|| event.isAccepted(gesture)
event.isAccepted(gesture)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
659 QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);-
660 ((!(w)) ? qt_assert("w",__FILE__,720) : qt_noop());-
661 for (bool qt_category_enabled = lcGestureManager().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 721, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "started gesture was delivered and accepted by" << w;
never executed: QMessageLogger(__FILE__, 721, __PRETTY_FUNCTION__, lcGestureManager().categoryName()).debug() << "started gesture was delivered and accepted by" << w;
0
662 m_gestureTargets[gesture] = w;-
663 }
never executed: end of block
0
664 }
never executed: end of block
0
665 }
never executed: end of block
0
666 }
never executed: end of block
0
667}
never executed: end of block
0
668-
669void QGestureManager::recycle(QGesture *gesture)-
670{-
671 QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0);-
672 if (recognizer
recognizerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
673 gesture->setGestureCancelPolicy(QGesture::CancelNone);-
674 recognizer->reset(gesture);-
675 m_activeGestures.remove(gesture);-
676 }
never executed: end of block
else {
0
677 cleanupGesturesForRemovedRecognizer(gesture);-
678 }
never executed: end of block
0
679}-
680-
681bool QGestureManager::gesturePending(QObject *o)-
682{-
683 const QGestureManager *gm = QGestureManager::instance();-
684 return
never executed: return gm && gm->m_gestureOwners.key(o);
gm && gm->m_gestureOwners.key(o);
never executed: return gm && gm->m_gestureOwners.key(o);
0
685}-
686-
687-
688-
689-
690-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9