From 25fcb413cf2bddb85c997bc4442dbd038140d76f Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 14 Aug 2023 03:16:20 +0300 Subject: [PATCH] tst_QTextLayout: compile with QT_NO_FOREACH The container is local, and it's not changed in the loop body; port to ranged-for and use std::as_const. Task-number: QTBUG-115839 Change-Id: If4d46f55e7aae8c87f6d7b3c4e78da7e51e128c0 Reviewed-by: Marc Mutz --- tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index b7720a8ac56..eced0137fb5 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - /* !!!!!! Warning !!!!! Please don't save this file in emacs. It contains utf8 text sequences emacs will @@ -2466,7 +2464,7 @@ void tst_QTextLayout::superscriptCrash_qtbug53911() } // This loop would crash before fix for QTBUG-53911 - foreach (QTextLayout *textLayout, textLayouts) { + for (QTextLayout *textLayout : std::as_const(textLayouts)) { textLayout->beginLayout(); while (textLayout->createLine().isValid()); textLayout->endLayout();