From 132095e8db06cc1dcfe97c93b5908ae5c5ade5bb Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 12 Mar 2020 09:59:07 +0100 Subject: [PATCH] avoid deprecation warnings --- src/controls/QskScrollView.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/controls/QskScrollView.cpp b/src/controls/QskScrollView.cpp index 7827affa..b3bd8a16 100644 --- a/src/controls/QskScrollView.cpp +++ b/src/controls/QskScrollView.cpp @@ -210,13 +210,24 @@ QPointF QskScrollView::scrollOffset( const QWheelEvent* event ) const { QPointF offset; - if ( subControlRect( VerticalScrollBar ).contains( event->posF() ) ) +#if QT_VERSION < 0x050e00 + const auto wheelPos = event->posF(); + const auto wheelDelta = event->delta(); +#else + const auto wheelPos = event->position(); + + const QPoint delta = event->angleDelta(); + const int wheelDelta = ( qAbs( delta.x() ) > qAbs( delta.y() ) ) + ? delta.x() : delta.y(); +#endif + + if ( subControlRect( VerticalScrollBar ).contains( wheelPos ) ) { - offset.setY( event->delta() ); + offset.setY( wheelDelta ); } - else if ( subControlRect( HorizontalScrollBar ).contains( event->posF() ) ) + else if ( subControlRect( HorizontalScrollBar ).contains( wheelPos ) ) { - offset.setX( event->delta() ); + offset.setX( wheelDelta ); } else {