From 106740abcad6ec1f8902c7a5f3a1cf1ad1710547 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sun, 30 Oct 2011 16:43:00 -0400 Subject: [PATCH] Fix bug where all stars could actr as if they were hovered in all the items --- src/GetNewStuffDelegate.cpp | 4 +++- src/GetNewStuffDelegate.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GetNewStuffDelegate.cpp b/src/GetNewStuffDelegate.cpp index d2d2d98e1..8a5e5d25f 100644 --- a/src/GetNewStuffDelegate.cpp +++ b/src/GetNewStuffDelegate.cpp @@ -192,7 +192,7 @@ GetNewStuffDelegate::paint( QPainter* painter, const QStyleOptionViewItem& optio m_cachedStarRects[ QPair(index.row(), index.column()) ] = r; QPixmap pm; - if ( m_hoveringOver > -1 ) + if ( m_hoveringOver > -1 && ( m_hoveringItem.first == index.row() && m_hoveringItem.second == index.column() ) ) { if ( i <= m_hoveringOver ) // positive star painter->drawPixmap( r, m_onHoverStar ); @@ -303,6 +303,8 @@ GetNewStuffDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, cons { // 0-indexed m_hoveringOver = whichStar; + m_hoveringItem.first = index.row(); + m_hoveringItem.second = index.column(); } return true; diff --git a/src/GetNewStuffDelegate.h b/src/GetNewStuffDelegate.h index e2b71afaa..853e3c74d 100644 --- a/src/GetNewStuffDelegate.h +++ b/src/GetNewStuffDelegate.h @@ -39,6 +39,7 @@ private: int m_widestTextWidth; int m_hoveringOver; + QPair m_hoveringItem; mutable QHash< QPair, QRect > m_cachedButtonRects; mutable QHash< QPair, QRect > m_cachedStarRects; };