summaryrefslogtreecommitdiffstats
path: root/tests/manual/gestures/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/gestures/graphicsview')
-rw-r--r--tests/manual/gestures/graphicsview/CMakeLists.txt7
-rw-r--r--tests/manual/gestures/graphicsview/gestures.cpp39
-rw-r--r--tests/manual/gestures/graphicsview/gestures.h31
-rw-r--r--tests/manual/gestures/graphicsview/imageitem.cpp29
-rw-r--r--tests/manual/gestures/graphicsview/imageitem.h29
-rw-r--r--tests/manual/gestures/graphicsview/main.cpp41
-rw-r--r--tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp31
-rw-r--r--tests/manual/gestures/graphicsview/mousepangesturerecognizer.h29
8 files changed, 30 insertions, 206 deletions
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