summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/widgets/graphicsview
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-08-05 19:15:17 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-08-08 16:03:28 +0200
commit62312e667441aea32ebaf70f1304d3fb0381f48f (patch)
tree9049b99c2c85ec9c6724e56ff14aa20f8d409ca7 /tests/benchmarks/widgets/graphicsview
parent11c2a5b4778dc2c67cf21c020e8266067a99f3d2 (diff)
GraphicsViewBenchmark: port from QList/Q_FOREACH to initializer_list/ranged-for
This is more readable and at the same time helps to eradicate some more Q_FOREACH uses for an eventual global QT_NO_FOREACH for all Qt sources (QTBUG-115796). Task-number: QTBUG-115803 Change-Id: I9cbe76bee8a6306fab0c0bc94cd874405ca825ba Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'tests/benchmarks/widgets/graphicsview')
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp45
1 files changed, 9 insertions, 36 deletions
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp
index 9b31bf88db..ce0c683f2d 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp
@@ -541,23 +541,11 @@ void tst_GraphicsViewBenchmark::update_data()
QTest::addColumn<bool>("subtreeCache");
QTest::addColumn<int>("rotationAngle");
- QList<ListType> listTypes;
- listTypes << Simple << Recycling;
-
- QList<int> listSizes;
- listSizes << 10 << 50 << 500;
-
- QList<Theme::Themes> themes;
- themes << Theme::Blue << Theme::Lime;
-
- QList<int> rotationAngles;
- rotationAngles << 0 << 90;
-
// Generate rows:
- foreach (ListType listType, listTypes) {
- foreach (int listSize, listSizes) {
- foreach (int angle, rotationAngles) {
- foreach (Theme::Themes theme, themes) {
+ for (ListType listType : {Simple, Recycling}) {
+ for (int listSize : {10, 50, 500}) {
+ for (int angle : {0, 90}) {
+ for (Theme::Themes theme : {Theme::Blue, Theme::Lime}) {
for (int toImage = 0; toImage < 2; ++toImage) {
for (int cache = 0; cache < 2; ++cache) {
QString string = rowString(listSize, listType, theme, toImage, cache, angle);
@@ -613,27 +601,12 @@ void tst_GraphicsViewBenchmark::scroll_data()
QTest::addColumn<int>("rotationAngle");
QTest::addColumn<ScrollStep>("scrollStep");
- QList<ListType> listTypes;
- listTypes << Simple << Recycling;
-
- QList<int> listSizes;
- listSizes << 10 << 50 << 500;
-
- QList<Theme::Themes> themes;
- themes << Theme::Blue << Theme::Lime;
-
- QList<int> rotationAngles;
- rotationAngles << 0 << 90;
-
- QList<ScrollStep> scrollSteps;
- scrollSteps << Slow << Normal << Fast;
-
// Generate rows:
- foreach (ListType listType, listTypes) {
- foreach (int listSize, listSizes) {
- foreach (int angle, rotationAngles) {
- foreach (ScrollStep step, scrollSteps) {
- foreach (Theme::Themes theme, themes) {
+ for (ListType listType : {Simple, Recycling}) {
+ for (int listSize : {10, 50, 500}) {
+ for (int angle : {0, 90}) {
+ for (ScrollStep step : {Slow, Normal, Fast}) {
+ for (Theme::Themes theme : {Theme::Blue, Theme::Lime}) {
for (int cache = 0; cache < 2; ++cache) {
QString string = rowString(listSize, listType, theme, cache, angle, step);
QTest::newRow(string.toLatin1()) << listSize << listType << theme