diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-07 12:56:49 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-07 16:03:01 +0200 |
commit | a11c776c444c0be1fd33276fc7ed4bef4494068c (patch) | |
tree | e9e006bb49a10f224b944c7a3a449b1c204d9862 | |
parent | e5dc46d966a0c98eee4360444963b4d0c3ab9e49 (diff) |
QApplicationPrivate: iterate QPointingDevPrv::activePoints values only
In translateTouchCancel() and findClosestTouchPointTarget(), in the
context of doing a range-for loop over activePoints:
for (const auto &pair : devPriv->activePoints) { ... }
clang was warning that the reference to the pair is a copy:
warning: loop variable 'pair' is always a copy because the range of type
'QPointingDevicePrivate::EventPointMap' (aka 'QFlatMap<int, QPointingDevicePrivate::EventPointData>')
does not return a reference [-Wrange-loop-analysis]
But we weren't using the key anyway, so we might as well iterate over
values() just as various functions in QPointingDevicePrivate are doing.
Change-Id: Id8ee784255af98064e8347d5fa6a806d442933a8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index c19fa2cd66..fdfb54881a 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3914,8 +3914,8 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(const QPointingDevice QObject *closestTarget = nullptr; qreal closestDistance = 0; const QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(device); - for (const auto &pair : devPriv->activePoints) { - const auto &pt = pair.second.eventPoint; + for (auto &epd : devPriv->activePoints.values()) { + const auto &pt = epd.eventPoint; if (pt.id() != touchPoint.id()) { qreal dx = globalPos.x() - pt.globalPosition().x(); qreal dy = globalPos.y() - pt.globalPosition().y(); @@ -4077,8 +4077,8 @@ void QApplicationPrivate::translateTouchCancel(const QPointingDevice *device, ul QSet<QWidget *> widgetsNeedingCancel; const QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(device); - for (const auto &pair : devPriv->activePoints) { - const auto &pt = pair.second.eventPoint; + for (auto &epd : devPriv->activePoints.values()) { + const auto &pt = epd.eventPoint; QObject *target = static_cast<const QMutableEventPoint &>(pt).target(); if (target && target->isWidgetType()) widgetsNeedingCancel.insert(static_cast<QWidget *>(target)); |