From 0e5de43e10f730c697b62fdfff33aed5a457f394 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Aug 2023 19:32:09 +0200 Subject: [PATCH] QWidget benchmark: port away from Q_FOREACH This one isn't trivial, but straight-forward: the only place the container is modified is in fill(). Like the setOpaqueChildren() function, this is only called from top-level test functions, and, in particular, not from event handlers (setAttribute() sends events). That fill() doesn't clear() the container, even though the single UpdateWidget instance is being reused across test functions, looks wrong, but doesn't invalidate this analysis. Task-number: QTBUG-115803 Change-Id: I284a19da2fe476278986c61810dd334fc73034b0 Reviewed-by: Ahmad Samir Reviewed-by: Ivan Solovev --- tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp index 7e24d23c96..0e2aa4fde2 100644 --- a/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp @@ -49,7 +49,7 @@ public: void setOpaqueChildren(bool enable) { if (opaqueChildren != enable) { - foreach (QWidget *w, children) + for (QWidget *w : std::as_const(children)) w->setAttribute(Qt::WA_OpaquePaintEvent, enable); opaqueChildren = enable; processEvents();