diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-10 19:48:54 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-10-13 00:54:48 +0300 |
commit | a7d9ad9617754b68237a5b3aa52085e6c5502a8f (patch) | |
tree | 78365ad9d306ea9a0650a4e4e6bc0c9c2cffb058 | |
parent | 3f94513670fd6dc2a2ab68ec806df6eb1fa2c46c (diff) |
QGestureManager: port Q_FOREACH to ranged-for [3/6]
The "conflictedGestures" QHash is local to the function, and the code in
the loop body doesn't change it. The "gestures" QList (the value in the
QHash key/value pair) isn't changed in the loop (both the enclosing
for-loop and the for-loop iterating over the QList itself):
- the QGestureEvent constructor takes by const& so it couldn't have
changed the QList
So use a const QList& instead of a copy.
Task-number: QTBUG-115803
Change-Id: I4d7f2f833fe0119b9c1ffa91b0cdba9561025382
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r-- | src/widgets/kernel/qgesturemanager.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 071b7ad4a0..d1a013914f 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -651,7 +651,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, for (GesturesPerWidget::const_iterator it = conflictedGestures.constBegin(), e = conflictedGestures.constEnd(); it != e; ++it) { QWidget *receiver = it.key(); - QList<QGesture *> gestures = it.value(); + const QList<QGesture *> &gestures = it.value(); qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures; @@ -659,7 +659,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, event.t = QEvent::GestureOverride; // mark event and individual gestures as ignored event.ignore(); - foreach(QGesture *g, gestures) + for (QGesture *g : gestures) event.setAccepted(g, false); QCoreApplication::sendEvent(receiver, &event); |