1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 02:09:48 +01:00

Fix bug where all stars could actr as if they were hovered in all the items

This commit is contained in:
Leo Franchi 2011-10-30 16:43:00 -04:00
parent 1c50db9ce9
commit 106740abca
2 changed files with 4 additions and 1 deletions

View File

@ -192,7 +192,7 @@ GetNewStuffDelegate::paint( QPainter* painter, const QStyleOptionViewItem& optio
m_cachedStarRects[ QPair<int, int>(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;

View File

@ -39,6 +39,7 @@ private:
int m_widestTextWidth;
int m_hoveringOver;
QPair<int, int> m_hoveringItem;
mutable QHash< QPair<int, int>, QRect > m_cachedButtonRects;
mutable QHash< QPair<int, int>, QRect > m_cachedStarRects;
};