Improved CDockAreaTabBar::wheelEvent to use pixelDelta() if available (i.e. on Mac) and fall back to angleDelta() if not

This commit is contained in:
Uwe Kindler 2024-12-05 13:11:48 +01:00
parent f2378636e2
commit 224676836d

View File

@ -161,15 +161,13 @@ CDockAreaTabBar::~CDockAreaTabBar()
void CDockAreaTabBar::wheelEvent(QWheelEvent* Event) void CDockAreaTabBar::wheelEvent(QWheelEvent* Event)
{ {
Event->accept(); Event->accept();
const int direction = Event->angleDelta().y(); int numPixels = Event->pixelDelta().y();
if (direction < 0) if (!numPixels)
{ {
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 20); numPixels = Event->angleDelta().y() / 5;
}
else
{
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
} }
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - numPixels);
} }