From d0ae3a312a03c118a1aa25a4c6c0352375d569fc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 26 Mar 2020 16:50:40 +0100 Subject: Remove QQuickPointerDevice in favor of QPointingDevice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...and generally deal with changes immediately required after adding QInputDevice and QPointingDevice. Also fixed a few usages of deprecated accessors that weren't taken care of in 212c2bffbb041aee0e3c9a7f0551ef151ed2d3ad. Task-number: QTBUG-46412 Task-number: QTBUG-69433 Task-number: QTBUG-72167 Change-Id: I93a2643162878afa216556f10808fd92e0b20071 Reviewed-by: Jan Arve Sæther --- tests/manual/pointer/inputinspector.cpp | 16 +++++++++++----- tests/manual/pointer/inputinspector.h | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'tests/manual') diff --git a/tests/manual/pointer/inputinspector.cpp b/tests/manual/pointer/inputinspector.cpp index 82d814b848..ff921fab0f 100644 --- a/tests/manual/pointer/inputinspector.cpp +++ b/tests/manual/pointer/inputinspector.cpp @@ -122,11 +122,17 @@ void InputInspector::timerEvent(QTimerEvent *event) update(); } -QQuickPointerDevice *InputInspector::pointerDevice() const +const QPointingDevice *InputInspector::pointerDevice() const { - QQuickPointerDevice *device = QQuickPointerDevice::touchDevices().value(0); + const QPointingDevice *device = nullptr; + for (const auto dev : QInputDevice::devices()) { + if (dev->type() == QInputDevice::DeviceType::TouchScreen) { + device = static_cast(dev); + break; + } + } if (!device) - device = QQuickPointerDevice::genericMouseDevice(); + device = QPointingDevice::primaryPointingDevice(); return device; } @@ -134,7 +140,7 @@ QVector InputInspector::passiveGrabbers_helper(int pointId /*= 0*/) co { QVector result; QSet visited; - QQuickPointerDevice *device = pointerDevice(); + const QPointingDevice *device = pointerDevice(); if (device && source()) { QQuickWindowPrivate *winPriv = QQuickWindowPrivate::get(source()); QQuickPointerEvent *pointerEvent = winPriv->pointerEventInstance(device); @@ -161,7 +167,7 @@ QVector InputInspector::exclusiveGrabbers_helper(int pointId /*= 0*/) { QVector result; QSet visited; - QQuickPointerDevice *device = pointerDevice(); + const QPointingDevice *device = pointerDevice(); if (device && source()) { QQuickWindowPrivate *winPriv = QQuickWindowPrivate::get(source()); QQuickPointerEvent *pointerEvent = winPriv->pointerEventInstance(device); diff --git a/tests/manual/pointer/inputinspector.h b/tests/manual/pointer/inputinspector.h index 66a053d0c3..0ef0a96987 100644 --- a/tests/manual/pointer/inputinspector.h +++ b/tests/manual/pointer/inputinspector.h @@ -32,7 +32,7 @@ #include class QQuickWindow; class QQuickPointerHandler; -class QQuickPointerDevice; +class QPointingDevice; class InputInspector : public QObject { @@ -62,7 +62,7 @@ private: QVector passiveGrabbers_helper(int pointId = 0) const; QVector exclusiveGrabbers_helper(int pointId = 0) const; static QString objectIdentifier(QObject *o); - QQuickPointerDevice *pointerDevice() const; + const QPointingDevice *pointerDevice() const; QString vectorStringJoin(const QVector &arr) const; private: -- cgit v1.2.3