Commit eee16b01 authored by Volker Krause's avatar Volker Krause
Browse files

Port away from deprecated QWheelEvent position methods

Those are gone in Qt6 (unlike similarly named methods for other
event types).
parent 51250cfb
Pipeline #149799 passed with stage
in 23 minutes and 28 seconds
......@@ -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);
......
......@@ -1006,7 +1006,7 @@ std::pair<bool, bool> 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<InternalClient *>(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;
}
......
......@@ -322,8 +322,8 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e)
case QEvent::Wheel:
{
QWheelEvent *we = static_cast<QWheelEvent *>(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());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment