From b768e84afe08457cd664f22a067b7b407c20d8b1 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Mon, 23 Jan 2012 18:34:07 +0100 Subject: [PATCH] * Better highlighting for artist names in AlbumView. --- src/libtomahawk/playlist/albumitemdelegate.cpp | 13 +++++++------ src/libtomahawk/utils/tomahawkutilsgui.cpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libtomahawk/playlist/albumitemdelegate.cpp b/src/libtomahawk/playlist/albumitemdelegate.cpp index 72035587d..e28208248 100644 --- a/src/libtomahawk/playlist/albumitemdelegate.cpp +++ b/src/libtomahawk/playlist/albumitemdelegate.cpp @@ -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; } diff --git a/src/libtomahawk/utils/tomahawkutilsgui.cpp b/src/libtomahawk/utils/tomahawkutilsgui.cpp index d4def733f..4d1d419d5 100644 --- a/src/libtomahawk/utils/tomahawkutilsgui.cpp +++ b/src/libtomahawk/utils/tomahawkutilsgui.cpp @@ -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 ); }