From 3740f04dd0344ada9bc9033fbb7c5cf8f363c560 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 20 Jan 2022 15:55:25 +0100 Subject: [PATCH] Core: Cleanup in ListItemDelegate::paint Do some stuff only if animationProgress < 1. Change-Id: Ib864cae64e8454ea7ad71f872d572a72d4e0c893 Reviewed-by: Reviewed-by: Christian Stenger --- src/plugins/coreplugin/welcomepagehelper.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/coreplugin/welcomepagehelper.cpp b/src/plugins/coreplugin/welcomepagehelper.cpp index e5c69d32797..e6743216ea0 100644 --- a/src/plugins/coreplugin/welcomepagehelper.cpp +++ b/src/plugins/coreplugin/welcomepagehelper.cpp @@ -412,10 +412,13 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti } constexpr float hoverAnimationDuration = 260; animationProgress = m_startTime.elapsed() / hoverAnimationDuration; - static const QEasingCurve animationCurve(QEasingCurve::OutCubic); - offset = animationCurve.valueForProgress(animationProgress) * shiftY; - if (offset < shiftY) + if (animationProgress < 1) { + static const QEasingCurve animationCurve(QEasingCurve::OutCubic); + offset = animationCurve.valueForProgress(animationProgress) * shiftY; QTimer::singleShot(10, this, &ListItemDelegate::goon); + } else { + offset = shiftY; + } } else if (index == m_previousIndex) { m_previousIndex = QModelIndex(); }