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)
{
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);
}