Skip to content

Commit

Permalink
Improved CDockAreaTabBar::wheelEvent to use pixelDelta() if available…
Browse files Browse the repository at this point in the history
… (i.e. on Mac) and fall back to angleDelta() if not
  • Loading branch information
githubuser0xFFFF committed Dec 5, 2024
1 parent f237863 commit 2246768
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/DockAreaTabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit 2246768

Please sign in to comment.