on xenial help sign in
Cursor plugin: add scroll wheel handling Fixes: #1497091

Approved by: Lukáš Tinkl

commitfd584cc62e4062f78ac1c86f746e190a6422d3a3 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 26 Nov 2015, 13:51 (11 years ago) parentcb8056283cfb65
2 files changed+12
plugins/Cursor/MousePointer.cpp+11 plugins/Cursor/MousePointer.h+1
plugins/Cursor/MousePointer.cpp+11
@@ -65,6 +65,17 @@ void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::Mouse
6565 buttons, modifiers);
6666}
6767
68+void MousePointer::handleWheelEvent(ulong timestamp, QPoint angleDelta, Qt::KeyboardModifiers modifiers)
69+{
70+ if (!parentItem()) {
71+ return;
72+ }
73+
74+ QPointF scenePosition = mapToItem(nullptr, QPointF(0, 0));
75+ QWindowSystemInterface::handleWheelEvent(window(), timestamp, scenePosition /* local */, scenePosition /* global */,
76+ QPoint() /* pixelDelta */, angleDelta, modifiers, Qt::ScrollUpdate);
77+}
78+
6879void MousePointer::itemChange(ItemChange change, const ItemChangeData &value)
6980{
7081 if (change == ItemSceneChange) {
plugins/Cursor/MousePointer.h+1
@@ -43,6 +43,7 @@ public:
4343public Q_SLOTS:
4444 void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
4545 Qt::KeyboardModifiers modifiers) override;
46+ void handleWheelEvent(ulong timestamp, QPoint angleDelta, Qt::KeyboardModifiers modifiers) override;
4647
4748Q_SIGNALS:
4849 void pushedLeftBoundary(qreal amount, Qt::MouseButtons buttons);