]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Port away from QWheelEvent::orientation()
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Thu, 28 May 2020 16:53:31 +0000 (18:53 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Mon, 17 Aug 2020 20:19:44 +0000 (20:19 +0000)
We are supposed to use QWheelEvent::angleDelta() instead. Upon an
horizontal/vertical scroll event, its `x()`/`y()` method will return a
value different from zero.

src/kitemviews/kitemlistcontainer.cpp

index 6279b15a994baf8f0f7579f57aa47a981ccf584d..e482f6eac324b3389ae397b07c0eef8fedd9e57e 100644 (file)
@@ -176,8 +176,8 @@ void KItemListContainer::wheelEvent(QWheelEvent* event)
         return;
     }
 
-    const bool scrollHorizontally = (event->orientation() == Qt::Horizontal) ||
-                                    (event->orientation() == Qt::Vertical && !verticalScrollBar()->isVisible());
+    const bool scrollHorizontally = (event->angleDelta().x() != 0) ||
+                                    (event->angleDelta().y() != 0 && !verticalScrollBar()->isVisible());
     KItemListSmoothScroller* smoothScroller = scrollHorizontally ?
                                               m_horizontalSmoothScroller : m_verticalSmoothScroller;