diff options
Diffstat (limited to 'tests/manual/gestures')
-rw-r--r-- | tests/manual/gestures/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/gestures.cpp | 39 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/gestures.h | 31 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/imageitem.cpp | 29 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/imageitem.h | 29 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/main.cpp | 41 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp | 31 | ||||
-rw-r--r-- | tests/manual/gestures/graphicsview/mousepangesturerecognizer.h | 29 | ||||
-rw-r--r-- | tests/manual/gestures/scrollarea/CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/manual/gestures/scrollarea/main.cpp | 35 | ||||
-rw-r--r-- | tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp | 29 | ||||
-rw-r--r-- | tests/manual/gestures/scrollarea/mousepangesturerecognizer.h | 29 |
13 files changed, 48 insertions, 293 deletions
diff --git a/tests/manual/gestures/CMakeLists.txt b/tests/manual/gestures/CMakeLists.txt index 7011d3221d..7ae6ae38eb 100644 --- a/tests/manual/gestures/CMakeLists.txt +++ b/tests/manual/gestures/CMakeLists.txt @@ -1,4 +1,5 @@ -# Generated from gestures.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause add_subdirectory(graphicsview) add_subdirectory(scrollarea) diff --git a/tests/manual/gestures/graphicsview/CMakeLists.txt b/tests/manual/gestures/graphicsview/CMakeLists.txt index e998bf113e..acb4eb5463 100644 --- a/tests/manual/gestures/graphicsview/CMakeLists.txt +++ b/tests/manual/gestures/graphicsview/CMakeLists.txt @@ -1,17 +1,18 @@ -# Generated from graphicsview.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_manual_graphicsview Binary: ##################################################################### -qt_add_manual_test(tst_manual_graphicsview +qt_internal_add_manual_test(tst_manual_graphicsview GUI SOURCES gestures.cpp gestures.h imageitem.cpp imageitem.h main.cpp mousepangesturerecognizer.cpp mousepangesturerecognizer.h - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Widgets ) diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp index 6e5b07bf18..5a46246143 100644 --- a/tests/manual/gestures/graphicsview/gestures.cpp +++ b/tests/manual/gestures/graphicsview/gestures.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "gestures.h" @@ -54,17 +29,15 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture case QEvent::TouchUpdate: if (d->state() != Qt::NoGesture) { QTouchEvent *ev = static_cast<QTouchEvent*>(event); - if (ev->touchPoints().size() == 3) { + if (ev->points().size() == 3) { d->gestureFired = true; result = QGestureRecognizer::TriggerGesture; } else { result = QGestureRecognizer::MayBeGesture; - for (int i = 0; i < ev->touchPoints().size(); ++i) { - const QTouchEvent::TouchPoint &pt = ev->touchPoints().at(i); - const int distance = (pt.pos().toPoint() - pt.startPos().toPoint()).manhattanLength(); - if (distance > 20) { + for (const QEventPoint &pt : ev->points()) { + const int distance = (pt.globalPosition().toPoint() - pt.globalPressPosition().toPoint()).manhattanLength(); + if (distance > 20) result = QGestureRecognizer::CancelGesture; - } } } } else { diff --git a/tests/manual/gestures/graphicsview/gestures.h b/tests/manual/gestures/graphicsview/gestures.h index 4cfabc35df..525e9f04f6 100644 --- a/tests/manual/gestures/graphicsview/gestures.h +++ b/tests/manual/gestures/graphicsview/gestures.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef GESTURE_H #define GESTURE_H @@ -38,7 +13,7 @@ class ThreeFingerSlideGesture : public QGesture public: static Qt::GestureType Type; - ThreeFingerSlideGesture(QObject *parent = 0) : QGesture(parent) { } + ThreeFingerSlideGesture(QObject *parent = nullptr) : QGesture(parent) { } bool gestureFired; }; diff --git a/tests/manual/gestures/graphicsview/imageitem.cpp b/tests/manual/gestures/graphicsview/imageitem.cpp index cdb3b70766..6e93232f96 100644 --- a/tests/manual/gestures/graphicsview/imageitem.cpp +++ b/tests/manual/gestures/graphicsview/imageitem.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "imageitem.h" #include "gestures.h" diff --git a/tests/manual/gestures/graphicsview/imageitem.h b/tests/manual/gestures/graphicsview/imageitem.h index b66b377896..f3dd4cec9f 100644 --- a/tests/manual/gestures/graphicsview/imageitem.h +++ b/tests/manual/gestures/graphicsview/imageitem.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef IMAGEITEM_H #define IMAGEITEM_H diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index f08b2c3549..69d97bd0bc 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QApplication> #include <QMainWindow> @@ -44,7 +19,7 @@ class GraphicsView : public QGraphicsView { public: - GraphicsView(QGraphicsScene *scene, QWidget *parent = 0) + GraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr) : QGraphicsView(scene, parent) { } @@ -78,7 +53,7 @@ protected: class StandardGestures : public QWidget { public: - StandardGestures(QWidget *parent = 0) + StandardGestures(QWidget *parent = nullptr) : QWidget(parent) { scene = new QGraphicsScene(this); @@ -96,7 +71,7 @@ class GlobalViewGestures : public QWidget { Q_OBJECT public: - GlobalViewGestures(QWidget *parent = 0) + GlobalViewGestures(QWidget *parent = nullptr) : QWidget(parent) { scene = new QGraphicsScene(this); @@ -116,7 +91,7 @@ class GraphicsItemGestures : public QWidget { Q_OBJECT public: - GraphicsItemGestures(QWidget *parent = 0) + GraphicsItemGestures(QWidget *parent = nullptr) : QWidget(parent) { scene = new QGraphicsScene(this); @@ -168,8 +143,8 @@ MainWindow::MainWindow() void MainWindow::setDirectory(const QString &path) { QDir dir(path); - QStringList files = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot); - foreach(const QString &file, files) { + const QStringList files = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot); + for (const QString &file : files) { QImageReader img(path + QLatin1Char('/') +file); QImage image = img.read(); if (!image.isNull()) { diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp index 032fed933e..45580f8e88 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mousepangesturerecognizer.h" @@ -57,7 +32,7 @@ QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state, case QEvent::MouseButtonPress: case QEvent::MouseMove: case QEvent::MouseButtonRelease: - globalPos = static_cast<QMouseEvent *>(event)->globalPos(); + globalPos = static_cast<QMouseEvent *>(event)->globalPosition().toPoint(); break; default: break; diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h index 81eaea4f37..512171f1ae 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOUSEPANGESTURERECOGNIZER_H #define MOUSEPANGESTURERECOGNIZER_H diff --git a/tests/manual/gestures/scrollarea/CMakeLists.txt b/tests/manual/gestures/scrollarea/CMakeLists.txt index d1446964cd..02ea63d040 100644 --- a/tests/manual/gestures/scrollarea/CMakeLists.txt +++ b/tests/manual/gestures/scrollarea/CMakeLists.txt @@ -1,15 +1,18 @@ -# Generated from scrollarea.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## scrollarea Binary: ##################################################################### -qt_add_manual_test(scrollarea +qt_internal_add_manual_test(scrollarea GUI SOURCES main.cpp mousepangesturerecognizer.cpp mousepangesturerecognizer.h - PUBLIC_LIBRARIES + NO_PCH_SOURCES + main.cpp # undef QT_NO_FOREACH + LIBRARIES Qt::Gui Qt::Widgets ) diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index 517054eeb9..911c3530cf 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -1,30 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include <QApplication> #include <QSlider> @@ -44,7 +21,7 @@ class ScrollArea : public QScrollArea { Q_OBJECT public: - ScrollArea(QWidget *parent = 0) + ScrollArea(QWidget *parent = nullptr) : QScrollArea(parent), outside(false) { viewport()->grabGesture(Qt::PanGesture, Qt::ReceivePartialGestures); @@ -112,7 +89,7 @@ private: class Slider : public QSlider { public: - Slider(Qt::Orientation orientation, QWidget *parent = 0) + Slider(Qt::Orientation orientation, QWidget *parent = nullptr) : QSlider(orientation, parent) { grabGesture(Qt::PanGesture); diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index 9cf69abd97..c6d4295868 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mousepangesturerecognizer.h" diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h index 81eaea4f37..512171f1ae 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOUSEPANGESTURERECOGNIZER_H #define MOUSEPANGESTURERECOGNIZER_H |