From 1427aa6711c260b532919b239d8a0fdba4262735 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 16 Oct 2023 16:56:34 +0300 Subject: [PATCH] Tidy up qtextlayout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove unused variable - port index-based loop to range-based for - use const method more to avoid implicit detach Change-Id: I223f6c221d0c6277e94efd2e7b7be0f8d8456c60 Reviewed-by: MÃ¥rten Nordheim --- src/gui/text/qtextlayout.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 611369951c7..8aea333e5ca 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1043,12 +1043,9 @@ QList QTextLayout::glyphRuns(int from, for (int i=0; ilines.size(); ++i) { if (d->lines.at(i).from > from + length) break; - else if (d->lines.at(i).from + d->lines[i].length >= from) { - QList glyphRuns = QTextLine(i, d).glyphRuns(from, length, retrievalFlags); - - for (int j = 0; j < glyphRuns.size(); j++) { - const QGlyphRun &glyphRun = glyphRuns.at(j); - + else if (d->lines.at(i).from + d->lines.at(i).length >= from) { + const QList glyphRuns = QTextLine(i, d).glyphRuns(from, length, retrievalFlags); + for (const QGlyphRun &glyphRun : glyphRuns) { QRawFont rawFont = glyphRun.rawFont(); QFontEngine *fontEngine = rawFont.d->fontEngine; @@ -1107,7 +1104,6 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QList int firstLine = 0; int lastLine = d->lines.size(); for (int i = 0; i < d->lines.size(); ++i) { - QTextLine l(i, d); const QScriptLine &sl = d->lines.at(i); if (sl.y > clipe) {