diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-26 14:38:54 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-11 23:18:44 +0000 |
commit | 10742cf8949497b83b87133ed66ec119cb3ab08f (patch) | |
tree | 7cd1f26379840d1768d86851725465cde06455c9 /src/gui/text | |
parent | 37a933c2b14a4a1aad54af0eba0bc210ae5b549a (diff) |
QtGui: eradicate Q_FOREACH loops [const-& returns]
... by replacing them with C++11 range-for loops.
The function QObject::children() returns by const-reference,
so they can be passed to range-for without further changes.
Change-Id: I8cd2921165c45020914dd3a23b1f18b519fe7900
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextdocumentfragment.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 9325f78ba0..f8f4e454e0 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -851,7 +851,7 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx) int tableHeaderRowCount = 0; QVector<int> rowNodes; rowNodes.reserve(at(tableNodeIdx).children.count()); - foreach (int row, at(tableNodeIdx).children) + for (int row : at(tableNodeIdx).children) { switch (at(row).id) { case Html_tr: rowNodes += row; @@ -859,15 +859,17 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx) case Html_thead: case Html_tbody: case Html_tfoot: - foreach (int potentialRow, at(row).children) + for (int potentialRow : at(row).children) { if (at(potentialRow).id == Html_tr) { rowNodes += potentialRow; if (at(row).id == Html_thead) ++tableHeaderRowCount; } + } break; default: break; } + } QVector<RowColSpanInfo> rowColSpans; QVector<RowColSpanInfo> rowColSpanForColumn; @@ -876,7 +878,7 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx) for (int row : qAsConst(rowNodes)) { int colsInRow = 0; - foreach (int cell, at(row).children) + for (int cell : at(row).children) { if (at(cell).isTableCell()) { // skip all columns with spans from previous rows while (colsInRow < rowColSpanForColumn.size()) { @@ -913,6 +915,7 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx) rowColSpanForColumn[i] = spanInfo; } } + } table.columns = qMax(table.columns, colsInRow); |