From 4b17de7e8cd5a9b82100cf0e720db16b37a3bfba Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Mon, 15 Jul 2024 14:37:37 +0200 Subject: [PATCH] Fix annoying Qt touch event deprecations for real this time --- src/frontend/qt_sdl/Screen.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/frontend/qt_sdl/Screen.cpp b/src/frontend/qt_sdl/Screen.cpp index 29e0663a..c302d546 100644 --- a/src/frontend/qt_sdl/Screen.cpp +++ b/src/frontend/qt_sdl/Screen.cpp @@ -276,8 +276,13 @@ void ScreenPanel::tabletEvent(QTabletEvent* event) case QEvent::TabletPress: case QEvent::TabletMove: { +#if QT_VERSION_MAJOR == 6 + int x = event->position().x(); + int y = event->position().y(); +#else int x = event->x(); int y = event->y(); +#endif if (layout.GetTouchCoords(x, y, event->type()==QEvent::TabletMove)) { @@ -302,8 +307,10 @@ void ScreenPanel::tabletEvent(QTabletEvent* event) void ScreenPanel::touchEvent(QTouchEvent* event) { +#if QT_VERSION_MAJOR == 6 if (event->device()->type() == QInputDevice::DeviceType::TouchPad) return; +#endif event->accept(); @@ -311,9 +318,15 @@ void ScreenPanel::touchEvent(QTouchEvent* event) { case QEvent::TouchBegin: case QEvent::TouchUpdate: +#if QT_VERSION_MAJOR == 6 if (event->points().length() > 0) { QPointF lastPosition = event->points().first().lastPosition(); +#else + if (event->touchPoints().length() > 0) + { + QPointF lastPosition = event->touchPoints().first().lastPos(); +#endif int x = (int)lastPosition.x(); int y = (int)lastPosition.y();