X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b94b172f5163fe5daab50dc197171d3662ee7c0d..dd07a327:/src/kitemviews/private/kitemlistsmoothscroller.cpp diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index 1fc452542..0e7546044 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.cpp +++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp @@ -56,6 +56,9 @@ QScrollBar *KItemListSmoothScroller::scrollBar() const void KItemListSmoothScroller::setTargetObject(QObject *target) { + if (m_animation->state() == QAbstractAnimation::Running) { + m_animation->stop(); + } m_animation->setTargetObject(target); } @@ -66,6 +69,9 @@ QObject *KItemListSmoothScroller::targetObject() const void KItemListSmoothScroller::setPropertyName(const QByteArray &propertyName) { + if (m_animation->state() == QAbstractAnimation::Running) { + m_animation->stop(); + } m_animation->setPropertyName(propertyName); } @@ -207,17 +213,19 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent *event) m_smoothScrolling = true; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QWheelEvent *copy = event->clone(); QApplication::sendEvent(m_scrollBar, copy); event->setAccepted(copy->isAccepted()); -#else - QWheelEvent copy = *event; - QApplication::sendEvent(m_scrollBar, ©); - event->setAccepted(copy.isAccepted()); -#endif m_smoothScrolling = previous; } +bool KItemListSmoothScroller::isAnimating() +{ + if (m_animation) { + return (m_animation->state() == QAbstractAnimation::Running); + } + return false; +} + #include "moc_kitemlistsmoothscroller.cpp"