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 <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2023-08-05 19:32:09 +02:00
parent c0738f9ff0
commit 0e5de43e10

View File

@ -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();