QQuickLayout: improve polish loop warning

- Print the layout that caused (or detected) the loop to make finding
  it easier. Until now it was only possible to find the item by
  debugging Qt, which is tedious for users.
- Replace the module prefix ("Qt Quick Layouts") with a simpler
  "Layout" prefix, as qmlWarning(this) already ensures that the type
  name is printed at the beginning of the warning.

Pick-to: 6.5 6.6
Change-Id: Ief801cad21958d7a8da406452f2918889f90658f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This commit is contained in:
Mitch Curtis 2023-05-18 14:37:49 +08:00
parent f2173ff6c8
commit d62302a306
1 changed files with 2 additions and 1 deletions

View File

@ -845,7 +845,8 @@ void QQuickLayout::invalidate(QQuickItem * /*childItem*/)
qCDebug(lcQuickLayouts) << "QQuickLayout::invalidate(), polish()";
polish();
} else {
qmlWarning(this) << "Qt Quick Layouts: Polish loop detected. Aborting after two iterations.";
qmlWarning(this).nospace() << "Layout polish loop detected for " << this
<< ". Aborting after two iterations.";
}
}
}