┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/private
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2018-01-21 10:50:11 +0100
committerElvis Angelaccio <[email protected]>2018-01-27 17:40:59 +0100
commit7caef6d251a1611842f73a9942f1bfc1dd2ec13b (patch)
tree75c3987c162e767048216ebb092b401d1246cb22 /src/kitemviews/private
parentc5eb4e31161ccf422a2f2492fe998c5c9817bea4 (diff)
Port away from deprecated QStyle::SH_Widget_Animate
Summary: Use the new QStyle::SH_Widget_Animation_Duration instead, which allows us to not manually hardcode the duration. We still use 1 if animations are disabled, otherwise the scroll would not work at all. See also D5883 for some background. Test Plan: Played with different values in the Animation tab of the Breeze config dialog. Reviewers: #dolphin, broulik Reviewed By: broulik Subscribers: broulik Differential Revision: https://phabricator.kde.org/D10005
Diffstat (limited to 'src/kitemviews/private')
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index 17eac3b39..77a842838 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.cpp
+++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp
@@ -35,8 +35,14 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
m_animation(nullptr)
{
m_animation = new QPropertyAnimation(this);
- const int duration = m_scrollBar->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, m_scrollBar) ? 100 : 1;
- m_animation->setDuration(duration);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ const int animationDuration = m_scrollBar->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, m_scrollBar);
+ const bool animationEnabled = (animationDuration > 0);
+ #else
+ const int animationDuration = 100;
+ const bool animationEnabled = m_scrollBar->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, m_scrollBar);
+#endif
+ m_animation->setDuration(animationEnabled ? animationDuration : 1);
connect(m_animation, &QPropertyAnimation::stateChanged,
this, &KItemListSmoothScroller::slotAnimationStateChanged);