mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
* Better highlighting for artist names in AlbumView.
This commit is contained in:
parent
8fdddb501f
commit
b768e84afe
@ -179,23 +179,24 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
r.adjust( 4, 0, -4, -1 );
|
||||
if ( m_hoveringOver == index )
|
||||
{
|
||||
TomahawkUtils::drawQueryBackground( painter, opt.palette, r, 1.5 );
|
||||
TomahawkUtils::drawQueryBackground( painter, opt.palette, r, 1.1 );
|
||||
painter->setPen( opt.palette.color( QPalette::HighlightedText ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !( option.state & QStyle::State_Selected ) )
|
||||
#ifdef Q_WS_MAC
|
||||
painter->setPen( opt.palette.color( QPalette::Dark ).darker( 200 ) );
|
||||
painter->setPen( opt.palette.color( QPalette::Dark ).darker( 200 ) );
|
||||
#else
|
||||
painter->setPen( opt.palette.color( QPalette::Dark ) );
|
||||
painter->setPen( opt.palette.color( QPalette::Dark ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
to.setAlignment( Qt::AlignHCenter | Qt::AlignBottom );
|
||||
text = painter->fontMetrics().elidedText( item->album()->artist()->name(), Qt::ElideRight, textRect.width() - 3 );
|
||||
painter->drawText( textRect, text, to );
|
||||
// Calculate rect of artist on-hover button click area
|
||||
text = painter->fontMetrics().elidedText( item->album()->artist()->name(), Qt::ElideRight, textRect.width() - 10 );
|
||||
painter->drawText( textRect.adjusted( 5, -1, -5, -1 ), text, to );
|
||||
|
||||
// Calculate rect of artist on-hover button click area
|
||||
m_artistNameRects[ index ] = r;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ drawBackgroundAndNumbers( QPainter* painter, const QString& text, const QRect& f
|
||||
void
|
||||
drawQueryBackground( QPainter* p, const QPalette& palette, const QRect& r, qreal lightnessFactor )
|
||||
{
|
||||
p->setPen( palette.mid().color().lighter( lightnessFactor * 100 ) );
|
||||
p->setPen( palette.highlight().color().lighter( lightnessFactor * 100 ) );
|
||||
p->setBrush( palette.highlight().color().lighter( lightnessFactor * 100 ) );
|
||||
p->drawRoundedRect( r, 4.0, 4.0 );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user