QGestureManager: port to ranged-for [2/6]
The enclosing iterator-based loop: the loop body doesn't modify the `m_objectGestures` QMap (the original loop was using const_iterators), so port to ranged-for by using asKeyValueRange(). The foreach loop: the loop body doesn't modify the `gestures` QList, so a simple port to ranged-for. Task-number: QTBUG-115803 Change-Id: I92ba7ff6ef878d7e4b7115a8fab87e95a6d93182 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
parent
a3a53cdde4
commit
3f94513670
@ -106,11 +106,9 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
|
||||
}
|
||||
}
|
||||
|
||||
QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.constBegin();
|
||||
while (iter != m_objectGestures.constEnd()) {
|
||||
ObjectGesture objectGesture = iter.key();
|
||||
for (const auto &[objectGesture, gestures] : std::as_const(m_objectGestures).asKeyValueRange()) {
|
||||
if (objectGesture.gesture == type) {
|
||||
foreach (QGesture *g, iter.value()) {
|
||||
for (QGesture *g : gestures) {
|
||||
auto it = m_gestureToRecognizer.constFind(g);
|
||||
if (it != m_gestureToRecognizer.cend() && it.value()) {
|
||||
QGestureRecognizer *recognizer = it.value();
|
||||
@ -119,7 +117,6 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
|
||||
}
|
||||
}
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user