summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qgesturemanager.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-10-11 18:37:16 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-10-13 00:54:45 +0300
commit3f94513670fd6dc2a2ab68ec806df6eb1fa2c46c (patch)
tree9c8da7585bfa1035f05b9ca699f7baabd6a947d6 /src/widgets/kernel/qgesturemanager.cpp
parenta3a53cdde4bfe7aff556731a2270b75505d300a8 (diff)
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>
Diffstat (limited to 'src/widgets/kernel/qgesturemanager.cpp')
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 523d140d77..071b7ad4a0 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -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;
}
}