Core: Fix redrawing of the current area in ListItemDelegate

If the ItemView is scrolled during the hover animation (e.g. via
mouse wheel), the previously stored Item QRect is not valid,
anymore.

Change-Id: I97b81cf063479a988221142474c9f511d02414d8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Alessandro Portale
2022-01-20 16:37:28 +01:00
parent 7aa458f490
commit ebe5879723
2 changed files with 1 additions and 3 deletions

View File

@@ -406,7 +406,6 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
m_previousIndex = index;
m_blurredThumbnail = QPixmap();
m_startTime.start();
m_currentArea = rc;
m_currentWidget = qobject_cast<QAbstractItemView *>(
const_cast<QWidget *>(option.widget));
}
@@ -580,7 +579,7 @@ void ListItemDelegate::clickAction(const ListItem *) const
void ListItemDelegate::goon()
{
if (m_currentWidget)
m_currentWidget->viewport()->update(m_currentArea);
m_currentWidget->update(m_previousIndex);
}
} // namespace Core

View File

@@ -159,7 +159,6 @@ protected:
private:
mutable QPersistentModelIndex m_previousIndex;
mutable QElapsedTimer m_startTime;
mutable QRect m_currentArea;
mutable QPointer<QAbstractItemView> m_currentWidget;
mutable QVector<QPair<QString, QRect>> m_currentTagRects;
mutable QPixmap m_blurredThumbnail;