summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-08-11 01:33:49 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-10-13 00:54:54 +0300
commit8ce54407f27c209ad48d6ae3b15ad3230ffd0b93 (patch)
treedfb96fe0e64a54e8e306ecc5cb024d07847fffc6
parent2309b38a64b67b0f5deaa1e80d8f07df38ba0795 (diff)
QGestureManager: port Q_FOREACH to ranged-for [6/6]
These two QSetS are local to the function, the loop bodies don't modify them but they can't be made const due to the way they're filled. So use std::as_const and ranged-for. Un-blacklist the file, by removing "#undef QT_NO_FOREACH", and removing the source file from NO_PCH_SOURCES. Change-Id: I49b852aa865b0321d3e2f617466557d77143a32b Task-number: QTBUG-115803 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r--src/widgets/CMakeLists.txt1
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp6
2 files changed, 2 insertions, 5 deletions
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 8117ed9a31..9e21cfafd5 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -70,7 +70,6 @@ qt_internal_add_module(Widgets
"kernel/qt_widgets_pch.h"
NO_PCH_SOURCES
compat/removed_api.cpp
- kernel/qgesturemanager.cpp # undef QT_NO_FOREACH
GENERATE_CPP_EXPORTS
)
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index e2e6bcf328..c93876c500 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -1,8 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
-
#include "private/qgesturemanager_p.h"
#include "private/qstandardgestures_p.h"
#include "private/qwidget_p.h"
@@ -332,9 +330,9 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
// set the proper gesture state on each gesture
for (QGesture *gesture : startedGestures)
gesture->d_func()->state = Qt::GestureStarted;
- foreach (QGesture *gesture, triggeredGestures)
+ for (QGesture *gesture : std::as_const(triggeredGestures))
gesture->d_func()->state = Qt::GestureUpdated;
- foreach (QGesture *gesture, finishedGestures)
+ for (QGesture *gesture : std::as_const(finishedGestures))
gesture->d_func()->state = Qt::GestureFinished;
for (QGesture *gesture : canceledGestures)
gesture->d_func()->state = Qt::GestureCanceled;