X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/285c14dd4e2127a34c5bd936e7563be3e62baa90..refs/heads/master:/src/kitemviews/private/kitemlistsmoothscroller.cpp diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index fd26d198f..14a280e33 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.cpp +++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp @@ -29,7 +29,7 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar *scrollBar, QObject KConfigGroup configGroup(globalConfig, QStringLiteral("KDE")); updateAnimationDuration(configGroup.readEntry("SmoothScroll", true)); - QDBusConnection::sessionBus().connect(QStringLiteral(""), + QDBusConnection::sessionBus().connect(QString(), QStringLiteral("/SmoothScroll"), QStringLiteral("org.kde.SmoothScroll"), QStringLiteral("notifyChange"), @@ -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); } @@ -214,4 +220,12 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent *event) m_smoothScrolling = previous; } +bool KItemListSmoothScroller::isAnimating() +{ + if (m_animation) { + return (m_animation->state() == QAbstractAnimation::Running); + } + return false; +} + #include "moc_kitemlistsmoothscroller.cpp"