diff options
| author | Akseli Lahtinen <[email protected]> | 2024-12-02 11:40:03 +0200 |
|---|---|---|
| committer | Akseli Lahtinen <[email protected]> | 2024-12-02 11:40:03 +0200 |
| commit | 6c55cf4b6a89d0d58ee7a29122ac68ac70fad65c (patch) | |
| tree | eb5a9f4c360b7a2e369ba081e5f7a9392620f912 /src | |
| parent | 2e22ffbfaee6fa905a678e54c93b9e4c7db2f71c (diff) | |
KItemListSmoothScroller: stop animation on property or targetobject change
Due to changes in 15e0c2a98f480f203ce168b6fa9a2e1f2b0ed8f8 we do not
automatically stop animations now on property or targetobject change,
which causes warnings and timeouts.
This patch makes sure we stop them if their state is Running,
before modifying them.
See also:
https://invent.kde.org/system/dolphin/-/merge_requests/857#note_1083279
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/private/kitemlistsmoothscroller.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index 517f6d983..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); } |
