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>
This commit is contained in:
parent
e5dc46d966
commit
a11c776c44
@ -3914,8 +3914,8 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(const QPointingDevice
|
|||||||
QObject *closestTarget = nullptr;
|
QObject *closestTarget = nullptr;
|
||||||
qreal closestDistance = 0;
|
qreal closestDistance = 0;
|
||||||
const QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(device);
|
const QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(device);
|
||||||
for (const auto &pair : devPriv->activePoints) {
|
for (auto &epd : devPriv->activePoints.values()) {
|
||||||
const auto &pt = pair.second.eventPoint;
|
const auto &pt = epd.eventPoint;
|
||||||
if (pt.id() != touchPoint.id()) {
|
if (pt.id() != touchPoint.id()) {
|
||||||
qreal dx = globalPos.x() - pt.globalPosition().x();
|
qreal dx = globalPos.x() - pt.globalPosition().x();
|
||||||
qreal dy = globalPos.y() - pt.globalPosition().y();
|
qreal dy = globalPos.y() - pt.globalPosition().y();
|
||||||
@ -4077,8 +4077,8 @@ void QApplicationPrivate::translateTouchCancel(const QPointingDevice *device, ul
|
|||||||
|
|
||||||
QSet<QWidget *> widgetsNeedingCancel;
|
QSet<QWidget *> widgetsNeedingCancel;
|
||||||
const QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(device);
|
const QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(device);
|
||||||
for (const auto &pair : devPriv->activePoints) {
|
for (auto &epd : devPriv->activePoints.values()) {
|
||||||
const auto &pt = pair.second.eventPoint;
|
const auto &pt = epd.eventPoint;
|
||||||
QObject *target = static_cast<const QMutableEventPoint &>(pt).target();
|
QObject *target = static_cast<const QMutableEventPoint &>(pt).target();
|
||||||
if (target && target->isWidgetType())
|
if (target && target->isWidgetType())
|
||||||
widgetsNeedingCancel.insert(static_cast<QWidget *>(target));
|
widgetsNeedingCancel.insert(static_cast<QWidget *>(target));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user