From 224676836dd276a78c82d3e3fc2dfc1a46970338 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 5 Dec 2024 13:11:48 +0100 Subject: [PATCH] Improved CDockAreaTabBar::wheelEvent to use pixelDelta() if available (i.e. on Mac) and fall back to angleDelta() if not --- src/DockAreaTabBar.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index cf1cb09..cc9bd91 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -161,15 +161,13 @@ CDockAreaTabBar::~CDockAreaTabBar() void CDockAreaTabBar::wheelEvent(QWheelEvent* Event) { Event->accept(); - const int direction = Event->angleDelta().y(); - if (direction < 0) - { - horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 20); - } - else - { - horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20); - } + int numPixels = Event->pixelDelta().y(); + if (!numPixels) + { + numPixels = Event->angleDelta().y() / 5; + } + + horizontalScrollBar()->setValue(horizontalScrollBar()->value() - numPixels); }