QWidgetRepaintManager: port Q_FOREACH to ranged-for

The loop body doesn't change the QHash, so use asKeyValueRange() and
ranged-for.

Un-blacklist the file, by removing "#undef QT_NO_FOREACH", and removing
the source file from NO_PCH_SOURCES.

Task-number: QTBUG-115803
Change-Id: I22924d2addeed75867edf9f6cac53f1c6f266dcc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
bb10
Ahmad Samir 2023-10-11 19:50:11 +03:00
parent 368ea559eb
commit 4bfe6ea251
2 changed files with 1 additions and 4 deletions

View File

@ -71,7 +71,6 @@ qt_internal_add_module(Widgets
NO_PCH_SOURCES
compat/removed_api.cpp
kernel/qgesturemanager.cpp # undef QT_NO_FOREACH
kernel/qwidgetrepaintmanager.cpp # undef QT_NO_FOREACH
GENERATE_CPP_EXPORTS
)

View File

@ -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 "qplatformdefs.h"
#include "qwidgetrepaintmanager_p.h"
@ -50,7 +48,7 @@ public:
}
bool isLocked() const {
foreach (bool v, m_locked) {
for (const auto &[_, v] : m_locked.asKeyValueRange()) {
if (v)
return true;
}