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