QtWidgets benchmarks: port remaining users away from Q_FOREACH

These are all trivial: all are over (already or newly-made) const
local variables.

We don't have a mechanism to mark a subtree as Q_FOREACH-free, and
adding QT_NO_FOREACH to each executable is overkill, so we just have
to hope that no new uses are being introduced until we can mark the
whole QtBase module as Q_FOREACH-free.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I13dc176756633674bab8c93a342ecdba6c5dd23e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Marc Mutz 2023-08-05 10:43:43 +02:00 committed by Ahmad Samir
parent 5d8db914c9
commit d4ba159148
2 changed files with 10 additions and 10 deletions

View File

@ -90,9 +90,9 @@ void AbstractScrollArea::setViewport(QGraphicsWidget *viewport)
if (m_viewport) {
m_viewport->setParentItem(0);
QList<QGraphicsItem*> children = m_viewport->childItems();
const QList<QGraphicsItem*> children = m_viewport->childItems();
foreach (QGraphicsItem *child, children)
for (QGraphicsItem *child : children)
child->setParentItem(0);
delete m_viewport;

View File

@ -233,13 +233,13 @@ void tst_QTableView::rowInsertion_data()
void tst_QTableView::rowInsertion()
{
QFETCH(SpanList, spans);
QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
foreach (QRect span, spans)
for (QRect span : spans)
view.setSpan(span.top(), span.left(), span.height(), span.width());
view.show();
QTest::qWait(50);
@ -259,13 +259,13 @@ void tst_QTableView::rowRemoval_data()
void tst_QTableView::rowRemoval()
{
QFETCH(SpanList, spans);
QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
foreach (QRect span, spans)
for (QRect span : spans)
view.setSpan(span.top(), span.left(), span.height(), span.width());
view.show();
QTest::qWait(50);
@ -282,14 +282,14 @@ void tst_QTableView::columnInsertion_data()
void tst_QTableView::columnInsertion()
{
QFETCH(SpanList, spans);
QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
// Same set as for rowInsertion, just swapping columns and rows.
foreach (QRect span, spans)
for (QRect span : spans)
view.setSpan(span.left(), span.top(), span.width(), span.height());
view.show();
QTest::qWait(50);
@ -309,14 +309,14 @@ void tst_QTableView::columnRemoval_data()
void tst_QTableView::columnRemoval()
{
QFETCH(SpanList, spans);
QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
// Same set as for rowRemoval, just swapping columns and rows.
foreach (QRect span, spans)
for (QRect span : spans)
view.setSpan(span.left(), span.top(), span.width(), span.height());
view.show();
QTest::qWait(50);