diff options
Diffstat (limited to 'tests/manual/qgraphicsitemgroup')
-rw-r--r-- | tests/manual/qgraphicsitemgroup/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/manual/qgraphicsitemgroup/customitem.cpp | 10 | ||||
-rw-r--r-- | tests/manual/qgraphicsitemgroup/customitem.h | 2 | ||||
-rw-r--r-- | tests/manual/qgraphicsitemgroup/main.cpp | 2 | ||||
-rw-r--r-- | tests/manual/qgraphicsitemgroup/widget.cpp | 16 | ||||
-rw-r--r-- | tests/manual/qgraphicsitemgroup/widget.h | 2 |
6 files changed, 19 insertions, 20 deletions
diff --git a/tests/manual/qgraphicsitemgroup/CMakeLists.txt b/tests/manual/qgraphicsitemgroup/CMakeLists.txt index 316b240957..d6a158fac5 100644 --- a/tests/manual/qgraphicsitemgroup/CMakeLists.txt +++ b/tests/manual/qgraphicsitemgroup/CMakeLists.txt @@ -1,8 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from qgraphicsitemgroup.pro. - ##################################################################### ## qgraphicsitemgroup Binary: ##################################################################### @@ -13,12 +11,11 @@ qt_internal_add_manual_test(qgraphicsitemgroup customitem.cpp customitem.h main.cpp widget.cpp widget.h widget.ui + NO_PCH_SOURCES + widget.cpp # undef QT_NO_FOREACH LIBRARIES Qt::Gui Qt::Widgets ENABLE_AUTOGEN_TOOLS uic ) - -#### Keys ignored in scope 1:.:.:qgraphicsitemgroup.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/qgraphicsitemgroup/customitem.cpp b/tests/manual/qgraphicsitemgroup/customitem.cpp index 77b023337e..5df16291ad 100644 --- a/tests/manual/qgraphicsitemgroup/customitem.cpp +++ b/tests/manual/qgraphicsitemgroup/customitem.cpp @@ -1,5 +1,5 @@ // 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 #include "customitem.h" @@ -9,10 +9,10 @@ QList<CustomGroup*> CustomScene::selectedCustomGroups() const { - QList<QGraphicsItem*> all = selectedItems(); + const QList<QGraphicsItem*> all = selectedItems(); QList<CustomGroup*> groups; - foreach (QGraphicsItem *item, all) { + for (QGraphicsItem *item : all) { CustomGroup* group = qgraphicsitem_cast<CustomGroup*>(item); if (group) groups.append(group); @@ -23,10 +23,10 @@ QList<CustomGroup*> CustomScene::selectedCustomGroups() const QList<CustomItem*> CustomScene::selectedCustomItems() const { - QList<QGraphicsItem*> all = selectedItems(); + const QList<QGraphicsItem*> all = selectedItems(); QList<CustomItem*> items; - foreach (QGraphicsItem *item, all) { + for (QGraphicsItem *item : all) { CustomItem* citem = qgraphicsitem_cast<CustomItem*>(item); if (citem) items.append(citem); diff --git a/tests/manual/qgraphicsitemgroup/customitem.h b/tests/manual/qgraphicsitemgroup/customitem.h index 30a41b0699..78f195629d 100644 --- a/tests/manual/qgraphicsitemgroup/customitem.h +++ b/tests/manual/qgraphicsitemgroup/customitem.h @@ -1,5 +1,5 @@ // 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 #ifndef CUSTOMITEM_H #define CUSTOMITEM_H diff --git a/tests/manual/qgraphicsitemgroup/main.cpp b/tests/manual/qgraphicsitemgroup/main.cpp index 30add62d6b..d586e84d20 100644 --- a/tests/manual/qgraphicsitemgroup/main.cpp +++ b/tests/manual/qgraphicsitemgroup/main.cpp @@ -1,5 +1,5 @@ // 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 #include <QApplication> #include "widget.h" 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); diff --git a/tests/manual/qgraphicsitemgroup/widget.h b/tests/manual/qgraphicsitemgroup/widget.h index 8286258c24..51b2943282 100644 --- a/tests/manual/qgraphicsitemgroup/widget.h +++ b/tests/manual/qgraphicsitemgroup/widget.h @@ -1,5 +1,5 @@ // 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 #ifndef WIDGET_H #define WIDGET_H |