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>bb10
parent
3f94513670
commit
a7d9ad9617
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue