mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Improved CDockAreaTabBar::wheelEvent to use pixelDelta() if available (i.e. on Mac) and fall back to angleDelta() if not
This commit is contained in:
parent
f2378636e2
commit
224676836d
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user