From eee16b01a41b3428848507bc776030acc430bb7e Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Wed, 9 Mar 2022 17:28:31 +0100 Subject: [PATCH] Port away from deprecated QWheelEvent position methods Those are gone in Qt6 (unlike similarly named methods for other event types). --- autotests/libinput/input_event_test.cpp | 4 ++-- src/input.cpp | 10 +++++----- src/libkwineffects/kwinoffscreenquickview.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autotests/libinput/input_event_test.cpp b/autotests/libinput/input_event_test.cpp index e5f319a48c..59d51fe2f2 100644 --- a/autotests/libinput/input_event_test.cpp +++ b/autotests/libinput/input_event_test.cpp @@ -134,8 +134,8 @@ void InputEventsTest::testInitWheelEvent() Qt::ShiftModifier | Qt::ControlModifier, InputRedirection::PointerAxisSourceWheel, 300, &d); // compare QWheelEvent contract QCOMPARE(event.type(), QEvent::Wheel); - QCOMPARE(event.posF(), QPointF(100, 200)); - QCOMPARE(event.globalPosF(), QPointF(100, 200)); + QCOMPARE(event.position(), QPointF(100, 200)); + QCOMPARE(event.globalPosition(), QPointF(100, 200)); QCOMPARE(event.buttons(), Qt::LeftButton | Qt::RightButton); QCOMPARE(event.modifiers(), Qt::ShiftModifier | Qt::ControlModifier); QCOMPARE(event.timestamp(), 300ul); diff --git a/src/input.cpp b/src/input.cpp index c2d20c55b0..c3cce27cf9 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1006,7 +1006,7 @@ std::pair performClientWheelAction(QWheelEvent *event, AbstractClien } } if (wasAction) { - return std::make_pair(wasAction, !c->performMouseCommand(command, event->globalPos())); + return std::make_pair(wasAction, !c->performMouseCommand(command, event->globalPosition().toPoint())); } return std::make_pair(wasAction, false); } @@ -1032,7 +1032,7 @@ class InternalWindowEventFilter : public InputEventFilter { return false; } QWindow *internal = static_cast(input()->pointer()->focus())->internalWindow(); - const QPointF localPos = event->globalPosF() - internal->position(); + const QPointF localPos = event->globalPosition() - internal->position(); const Qt::Orientation orientation = (event->angleDelta().x() != 0) ? Qt::Horizontal : Qt::Vertical; const int delta = event->angleDelta().x() != 0 ? event->angleDelta().x() : event->angleDelta().y(); QWheelEvent wheelEvent(localPos, event->globalPosF(), QPoint(), @@ -1228,10 +1228,10 @@ public: return actionResult.second; } } - const QPointF localPos = event->globalPosF() - decoration->client()->pos(); + const QPointF localPos = event->globalPosition() - decoration->client()->pos(); const Qt::Orientation orientation = (event->angleDelta().x() != 0) ? Qt::Horizontal : Qt::Vertical; const int delta = event->angleDelta().x() != 0 ? event->angleDelta().x() : event->angleDelta().y(); - QWheelEvent e(localPos, event->globalPosF(), QPoint(), + QWheelEvent e(localPos, event->globalPosition(), QPoint(), event->angleDelta(), delta, orientation, @@ -1244,7 +1244,7 @@ public: } if ((orientation == Qt::Vertical) && decoration->client()->titlebarPositionUnderMouse()) { decoration->client()->performMouseCommand(options->operationTitlebarMouseWheel(delta * -1), - event->globalPosF().toPoint()); + event->globalPosition().toPoint()); } return true; } diff --git a/src/libkwineffects/kwinoffscreenquickview.cpp b/src/libkwineffects/kwinoffscreenquickview.cpp index 5804a9289d..aeb6269c32 100644 --- a/src/libkwineffects/kwinoffscreenquickview.cpp +++ b/src/libkwineffects/kwinoffscreenquickview.cpp @@ -322,8 +322,8 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e) case QEvent::Wheel: { QWheelEvent *we = static_cast(e); - const QPointF widgetPos = d->m_view->mapFromGlobal(we->pos()); - QWheelEvent cloneEvent(widgetPos, we->globalPosF(), we->pixelDelta(), we->angleDelta(), we->buttons(), + const QPointF widgetPos = d->m_view->mapFromGlobal(we->position().toPoint()); + QWheelEvent cloneEvent(widgetPos, we->globalPosition(), we->pixelDelta(), we->angleDelta(), we->buttons(), we->modifiers(), we->phase(), we->inverted()); QCoreApplication::sendEvent(d->m_view, &cloneEvent); e->setAccepted(cloneEvent.isAccepted());