From 233246730caa7b88a4d67e03d9f0dc70cede67ce Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 8 Jul 2020 11:44:58 +0300 Subject: [PATCH] Use of QWheelEvent::orientation has been deprecated since Qt 5.15. --- src/libs/vwidgets/vmaingraphicsview.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index 100ffab15..8351784c7 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -76,12 +76,12 @@ qreal ScrollingSteps(QWheelEvent* wheel_event) if (not numPixels.isNull()) { const qreal mouseScale = settings->GetSensorMouseScale(); - numSteps = (wheel_event->orientation() == Qt::Vertical ? numPixels.y() : numPixels.x()) / mouseScale; + numSteps = (numPixels.x() == 0 ? numPixels.y() : numPixels.x()) / mouseScale; } else if (not numDegrees.isNull()) { const qreal mouseScale = settings->GetWheelMouseScale(); - numSteps = (wheel_event->orientation() == Qt::Vertical ? numDegrees.y() : numDegrees.x()) / 15. * mouseScale; + numSteps = (numPixels.x() == 0 ? numDegrees.y() : numDegrees.x()) / 15. * mouseScale; } return numSteps; @@ -283,11 +283,12 @@ bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event) { if (QWheelEvent* wheel_event = static_cast(event)) { - if (wheel_event->orientation() == Qt::Vertical) + const QPoint numDegrees = wheel_event->angleDelta(); + if (numDegrees.x() == 0) { if (QGuiApplication::keyboardModifiers() == _modifiers) { - gentle_zoom(qPow(_zoom_factor_base, wheel_event->angleDelta().y())); + gentle_zoom(qPow(_zoom_factor_base, numDegrees.y())); return true; } else if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)