forked from qt-creator/qt-creator
Core: Cleanup in ListItemDelegate::paint
Do some stuff only if animationProgress < 1. Change-Id: Ib864cae64e8454ea7ad71f872d572a72d4e0c893 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user