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;
|
constexpr float hoverAnimationDuration = 260;
|
||||||
animationProgress = m_startTime.elapsed() / hoverAnimationDuration;
|
animationProgress = m_startTime.elapsed() / hoverAnimationDuration;
|
||||||
|
if (animationProgress < 1) {
|
||||||
static const QEasingCurve animationCurve(QEasingCurve::OutCubic);
|
static const QEasingCurve animationCurve(QEasingCurve::OutCubic);
|
||||||
offset = animationCurve.valueForProgress(animationProgress) * shiftY;
|
offset = animationCurve.valueForProgress(animationProgress) * shiftY;
|
||||||
if (offset < shiftY)
|
|
||||||
QTimer::singleShot(10, this, &ListItemDelegate::goon);
|
QTimer::singleShot(10, this, &ListItemDelegate::goon);
|
||||||
|
} else {
|
||||||
|
offset = shiftY;
|
||||||
|
}
|
||||||
} else if (index == m_previousIndex) {
|
} else if (index == m_previousIndex) {
|
||||||
m_previousIndex = QModelIndex();
|
m_previousIndex = QModelIndex();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user