From 481d2d699eb26f0e67c55ff862da8e2921984566 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 29 May 2020 17:42:40 +0200 Subject: [PATCH] Replace QWheelEvent::delta with QWheelEvent::angleDelta --- src/analyzer/analyzercontainer.cpp | 2 +- src/core/qtsystemtrayicon.cpp | 8 ++++---- src/widgets/tracksliderslider.cpp | 4 +++- src/widgets/volumeslider.cpp | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/analyzer/analyzercontainer.cpp b/src/analyzer/analyzercontainer.cpp index 55057463d..6355712bd 100644 --- a/src/analyzer/analyzercontainer.cpp +++ b/src/analyzer/analyzercontainer.cpp @@ -112,7 +112,7 @@ void AnalyzerContainer::ShowPopupMenu() { } void AnalyzerContainer::wheelEvent(QWheelEvent *e) { - emit WheelEvent(e->delta()); + emit WheelEvent(e->angleDelta().y()); } void AnalyzerContainer::SetEngine(EngineBase *engine) { diff --git a/src/core/qtsystemtrayicon.cpp b/src/core/qtsystemtrayicon.cpp index cd62cc707..eac8502af 100644 --- a/src/core/qtsystemtrayicon.cpp +++ b/src/core/qtsystemtrayicon.cpp @@ -93,7 +93,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::Wheel) { QWheelEvent *e = static_cast(event); if (e->modifiers() == Qt::ShiftModifier) { - if (e->delta() > 0) { + if (e->angleDelta().y() > 0) { emit SeekForward(); } else { @@ -101,7 +101,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) { } } else if (e->modifiers() == Qt::ControlModifier) { - if (e->delta() < 0) { + if (e->angleDelta().y() < 0) { emit NextTrack(); } else { @@ -114,7 +114,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) { bool prev_next_track = s.value("scrolltrayicon").toBool(); s.endGroup(); if (prev_next_track) { - if (e->delta() < 0) { + if (e->angleDelta().y() < 0) { emit NextTrack(); } else { @@ -122,7 +122,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) { } } else { - emit ChangeVolume(e->delta()); + emit ChangeVolume(e->angleDelta().y()); } } return true; diff --git a/src/widgets/tracksliderslider.cpp b/src/widgets/tracksliderslider.cpp index 23cc6818a..227fee86e 100644 --- a/src/widgets/tracksliderslider.cpp +++ b/src/widgets/tracksliderslider.cpp @@ -109,13 +109,15 @@ void TrackSliderSlider::mouseMoveEvent(QMouseEvent* e) { } void TrackSliderSlider::wheelEvent(QWheelEvent *e) { - if (e->delta() < 0) { + + if (e->angleDelta().y() < 0) { emit SeekBackward(); } else { emit SeekForward(); } e->accept(); + } void TrackSliderSlider::enterEvent(QEvent* e) { diff --git a/src/widgets/volumeslider.cpp b/src/widgets/volumeslider.cpp index 1f49a0757..44163cfcc 100644 --- a/src/widgets/volumeslider.cpp +++ b/src/widgets/volumeslider.cpp @@ -65,7 +65,7 @@ void SliderSlider::wheelEvent(QWheelEvent* e) { } // Position Slider (horizontal) - int step = e->delta() * 1500 / 18; + int step = e->angleDelta().y() * 1500 / 18; int nval = qBound(minimum(), QSlider::value() + step, maximum()); QSlider::setValue(nval); @@ -303,7 +303,7 @@ void VolumeSlider::slideEvent(QMouseEvent* e) { void VolumeSlider::wheelEvent(QWheelEvent* e) { - const uint step = e->delta() / (e->orientation() == Qt::Vertical ? 30 : -30); + const uint step = e->angleDelta().y() / (e->angleDelta().x() == 0 ? 30 : -30); QSlider::setValue(QSlider::value() + step); emit sliderReleased(value());