Replace QWheelEvent::delta with QWheelEvent::angleDelta

This commit is contained in:
Jonas Kvinge 2020-05-29 17:42:40 +02:00
parent cf9a7e6ed3
commit 481d2d699e
4 changed files with 10 additions and 8 deletions

View File

@ -112,7 +112,7 @@ void AnalyzerContainer::ShowPopupMenu() {
} }
void AnalyzerContainer::wheelEvent(QWheelEvent *e) { void AnalyzerContainer::wheelEvent(QWheelEvent *e) {
emit WheelEvent(e->delta()); emit WheelEvent(e->angleDelta().y());
} }
void AnalyzerContainer::SetEngine(EngineBase *engine) { void AnalyzerContainer::SetEngine(EngineBase *engine) {

View File

@ -93,7 +93,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) {
if (event->type() == QEvent::Wheel) { if (event->type() == QEvent::Wheel) {
QWheelEvent *e = static_cast<QWheelEvent*>(event); QWheelEvent *e = static_cast<QWheelEvent*>(event);
if (e->modifiers() == Qt::ShiftModifier) { if (e->modifiers() == Qt::ShiftModifier) {
if (e->delta() > 0) { if (e->angleDelta().y() > 0) {
emit SeekForward(); emit SeekForward();
} }
else { else {
@ -101,7 +101,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) {
} }
} }
else if (e->modifiers() == Qt::ControlModifier) { else if (e->modifiers() == Qt::ControlModifier) {
if (e->delta() < 0) { if (e->angleDelta().y() < 0) {
emit NextTrack(); emit NextTrack();
} }
else { else {
@ -114,7 +114,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) {
bool prev_next_track = s.value("scrolltrayicon").toBool(); bool prev_next_track = s.value("scrolltrayicon").toBool();
s.endGroup(); s.endGroup();
if (prev_next_track) { if (prev_next_track) {
if (e->delta() < 0) { if (e->angleDelta().y() < 0) {
emit NextTrack(); emit NextTrack();
} }
else { else {
@ -122,7 +122,7 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) {
} }
} }
else { else {
emit ChangeVolume(e->delta()); emit ChangeVolume(e->angleDelta().y());
} }
} }
return true; return true;

View File

@ -109,13 +109,15 @@ void TrackSliderSlider::mouseMoveEvent(QMouseEvent* e) {
} }
void TrackSliderSlider::wheelEvent(QWheelEvent *e) { void TrackSliderSlider::wheelEvent(QWheelEvent *e) {
if (e->delta() < 0) {
if (e->angleDelta().y() < 0) {
emit SeekBackward(); emit SeekBackward();
} }
else { else {
emit SeekForward(); emit SeekForward();
} }
e->accept(); e->accept();
} }
void TrackSliderSlider::enterEvent(QEvent* e) { void TrackSliderSlider::enterEvent(QEvent* e) {

View File

@ -65,7 +65,7 @@ void SliderSlider::wheelEvent(QWheelEvent* e) {
} }
// Position Slider (horizontal) // Position Slider (horizontal)
int step = e->delta() * 1500 / 18; int step = e->angleDelta().y() * 1500 / 18;
int nval = qBound(minimum(), QSlider::value() + step, maximum()); int nval = qBound(minimum(), QSlider::value() + step, maximum());
QSlider::setValue(nval); QSlider::setValue(nval);
@ -303,7 +303,7 @@ void VolumeSlider::slideEvent(QMouseEvent* e) {
void VolumeSlider::wheelEvent(QWheelEvent* 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); QSlider::setValue(QSlider::value() + step);
emit sliderReleased(value()); emit sliderReleased(value());