diff options
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/pointer/inputinspector.cpp | 42 | ||||
-rw-r--r-- | tests/manual/pointer/inputinspector.h | 4 | ||||
-rw-r--r-- | tests/manual/pointer/singlePointHandlerProperties.qml | 2 | ||||
-rw-r--r-- | tests/manual/pointer/tapHandler.qml | 2 |
4 files changed, 16 insertions, 34 deletions
diff --git a/tests/manual/pointer/inputinspector.cpp b/tests/manual/pointer/inputinspector.cpp index ff921fab0f..b919c489f4 100644 --- a/tests/manual/pointer/inputinspector.cpp +++ b/tests/manual/pointer/inputinspector.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the manual tests of the Qt Toolkit. @@ -27,9 +27,9 @@ ****************************************************************************/ #include "inputinspector.h" -#include <QtQuick/QQuickWindow> #include <QtQuick/QQuickItem> #include <QtQuick/private/qquickpointerhandler_p.h> +#include <QtGui/private/qpointingdevice_p.h> #include <QtCore/QSet> static const int timerInterval = 100; @@ -139,23 +139,13 @@ const QPointingDevice *InputInspector::pointerDevice() const QVector<QObject*> InputInspector::passiveGrabbers_helper(int pointId /*= 0*/) const { QVector<QObject*> result; - QSet<QObject*> visited; const QPointingDevice *device = pointerDevice(); if (device && source()) { - QQuickWindowPrivate *winPriv = QQuickWindowPrivate::get(source()); - QQuickPointerEvent *pointerEvent = winPriv->pointerEventInstance(device); - if (pointerEvent) { - for (int i = 0; i < pointerEvent->pointCount(); ++i) { - QQuickEventPoint *eventPoint = pointerEvent->point(i); - QVector<QPointer <QQuickPointerHandler> > passives = eventPoint->passiveGrabbers(); - if (!pointId || eventPoint->pointId() == pointId) { - for (auto it = passives.constBegin(); it != passives.constEnd(); ++it) { - QObject *handler = it->data(); - if (!visited.contains(handler)) { - result << it->data(); - visited << handler; - } - } + for (auto eventPoint : QPointingDevicePrivate::get(device)->activePoints) { + if (!pointId || eventPoint.id() == pointId) { + for (auto pg : eventPoint.passiveGrabbers()) { + if (!result.contains(pg)) + result << pg; } } } @@ -166,21 +156,13 @@ QVector<QObject*> InputInspector::passiveGrabbers_helper(int pointId /*= 0*/) co QVector<QObject*> InputInspector::exclusiveGrabbers_helper(int pointId /*= 0*/) const { QVector<QObject*> result; - QSet<QObject*> visited; const QPointingDevice *device = pointerDevice(); if (device && source()) { - QQuickWindowPrivate *winPriv = QQuickWindowPrivate::get(source()); - QQuickPointerEvent *pointerEvent = winPriv->pointerEventInstance(device); - if (pointerEvent) { - for (int i = 0; i < pointerEvent->pointCount(); ++i) { - QQuickEventPoint *eventPoint = pointerEvent->point(i); - if (!pointId || eventPoint->pointId() == pointId) { - if (QObject *exclusiveGrabber = eventPoint->exclusiveGrabber()) { - if (!visited.contains(exclusiveGrabber)) { - result << exclusiveGrabber; - visited << exclusiveGrabber; - } - } + for (auto eventPoint : QPointingDevicePrivate::get(device)->activePoints) { + if (!pointId || eventPoint.id() == pointId) { + if (auto g = eventPoint.exclusiveGrabber()) { + if (!result.contains(g)) + result << g; } } } diff --git a/tests/manual/pointer/inputinspector.h b/tests/manual/pointer/inputinspector.h index 0ef0a96987..31d99cf25d 100644 --- a/tests/manual/pointer/inputinspector.h +++ b/tests/manual/pointer/inputinspector.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the manual tests of the Qt Toolkit. @@ -30,7 +30,7 @@ #define INPUTINSPECTOR_H #include <QObject> -class QQuickWindow; +#include <QtQuick/QQuickWindow> class QQuickPointerHandler; class QPointingDevice; diff --git a/tests/manual/pointer/singlePointHandlerProperties.qml b/tests/manual/pointer/singlePointHandlerProperties.qml index c2500770f0..9bebf23810 100644 --- a/tests/manual/pointer/singlePointHandlerProperties.qml +++ b/tests/manual/pointer/singlePointHandlerProperties.qml @@ -140,7 +140,7 @@ Rectangle { id: pointHandler target: null acceptedButtons: Qt.AllButtons - onGrabChanged: if (active) { // 'point' is an implicit parameter referencing to a QQuickEventPoint instance + onGrabChanged: if (active) { // 'point' is an implicit parameter referencing to a QEventPoint instance console.log("grabbed " + point.pointId + " @ " + point.sceneGrabPos) grabbingLocationIndicator.createObject(root, {"x": point.sceneGrabPosition.x, "y": point.sceneGrabPosition.y - 16}) } diff --git a/tests/manual/pointer/tapHandler.qml b/tests/manual/pointer/tapHandler.qml index 8c1fac9a2f..6e51fc6fda 100644 --- a/tests/manual/pointer/tapHandler.qml +++ b/tests/manual/pointer/tapHandler.qml @@ -53,7 +53,7 @@ Item { borderBlink.blinkColor = "red" borderBlink.start() } - onTapped: { // 'eventPoint' is a signal parameter of type QQuickEventPoint* + onTapped: { // 'eventPoint' is a signal parameter of type QEventPoint* console.log("tapped button " + eventPoint.event.button + " @ " + eventPoint.scenePosition + " on device '" + eventPoint.event.device.name + "' " + (tapCount > 1 ? (tapCount + " times") : "for the first time")) if (tapCount > 1) { |