diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-11 17:20:24 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-19 16:29:25 +0300 |
commit | 8e0281a8becc699ece53527c647b1ee72e50c3bd (patch) | |
tree | ec1ac57e37431ea2b46384c6834fa0057ced62e8 /tests/auto/gui/painting | |
parent | e7b07b64c7b0536eccba6ff25e23badb88226813 (diff) |
tests/auto/: port Q_FOREACH to ranged-for, local const containers
These are local containers that are either:
- Already const and didn't need Q_FOREACH to begin with
- Can be simply made const, just by adding const keyword
In one case the unittest checked that the container's size is 1, so use
list.first() instead of a for-loop.
In files where Q_FOREACH isn't used any more, remove
"#undef QT_NO_FOREACH". Also remove those files from NO_PCH_SOURCES.
Drive-by changes:
- Remove parenthesis from one-line for-loops
- Make the for-loop variable a const& where a copy isn't needed
Task-number: QTBUG-115839
Change-Id: Ide34122b9cda798b80c4ca9d2d5af76024bc7a92
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r-- | tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 1606afca82..de2e966c53 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -3786,10 +3786,10 @@ static QLinearGradient inverseGradient(QLinearGradient g) { QLinearGradient g2 = g; - QGradientStops stops = g.stops(); + const QGradientStops stops = g.stops(); QGradientStops inverse; - foreach (QGradientStop stop, stops) + for (const QGradientStop &stop : stops) inverse << QGradientStop(1 - stop.first, stop.second); g2.setStops(inverse); |