]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/private/kitemlistsmoothscroller.cpp
Remove unused #include
[dolphin.git] / src / kitemviews / private / kitemlistsmoothscroller.cpp
index 17eac3b39ac63abf33e79bfe1f151f0850a95438..f1f6145c452a9d5566d9bbd62e0a1cbfd33c55b3 100644 (file)
@@ -20,7 +20,6 @@
 #include "kitemlistsmoothscroller.h"
 
 #include <QApplication>
-#include <QEvent>
 #include <QPropertyAnimation>
 #include <QScrollBar>
 #include <QWheelEvent>
@@ -35,8 +34,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);