summaryrefslogtreecommitdiffstats
path: root/tests/manual/qgraphicsitemgroup/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qgraphicsitemgroup/widget.cpp')
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp
index d6005601ca..25362d52a4 100644
--- a/tests/manual/qgraphicsitemgroup/widget.cpp
+++ b/tests/manual/qgraphicsitemgroup/widget.cpp
@@ -1,5 +1,7 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "widget.h"
#include "ui_widget.h"
@@ -95,15 +97,15 @@ void Widget::on_scaleItem_valueChanged(int value)
void Widget::on_group_clicked()
{
- QList<QGraphicsItem*> all = scene->selectedItems();
+ const QList<QGraphicsItem*> all = scene->selectedItems();
if (all.size() < 2)
return;
- QList<CustomItem*> items = scene->selectedCustomItems();
+ const QList<CustomItem*> items = scene->selectedCustomItems();
QList<CustomGroup*> groups = scene->selectedCustomGroups();
if (groups.size() == 1) {
- foreach (CustomItem *item, items) {
+ for (CustomItem *item : items) {
item->setSelected(false);
groups[0]->addToGroup(item);
}
@@ -113,7 +115,7 @@ void Widget::on_group_clicked()
CustomGroup* group = new CustomGroup;
scene->addItem(group);
- foreach (QGraphicsItem *item, all) {
+ for (QGraphicsItem *item : all) {
item->setSelected(false);
group->addToGroup(item);
}
@@ -124,9 +126,9 @@ void Widget::on_group_clicked()
void Widget::on_dismantle_clicked()
{
- QList<CustomGroup*> groups = scene->selectedCustomGroups();
+ const QList<CustomGroup*> groups = scene->selectedCustomGroups();
- foreach (CustomGroup *group, groups) {
+ for (CustomGroup *group : groups) {
foreach (QGraphicsItem *item, group->childItems())
group->removeFromGroup(item);