mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 17:14:00 +02:00
* Use the proper highlight color for painting hovered artist names in the AlbumItemDelegate.
This commit is contained in:
@@ -159,13 +159,19 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
r.setTop( r.bottom() - painter->fontMetrics().height() );
|
r.setTop( r.bottom() - painter->fontMetrics().height() );
|
||||||
r.adjust( 4, 0, -4, -1 );
|
r.adjust( 4, 0, -4, -1 );
|
||||||
if ( m_hoveringOver == index )
|
if ( m_hoveringOver == index )
|
||||||
|
{
|
||||||
TomahawkUtils::drawQueryBackground( painter, opt.palette, r, 1.5 );
|
TomahawkUtils::drawQueryBackground( painter, opt.palette, r, 1.5 );
|
||||||
|
painter->setPen( opt.palette.color( QPalette::HighlightedText ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
painter->setPen( opt.palette.color( QPalette::Dark ).darker( 200 ) );
|
painter->setPen( opt.palette.color( QPalette::Dark ).darker( 200 ) );
|
||||||
#else
|
#else
|
||||||
painter->setPen( opt.palette.color( QPalette::Dark ) );
|
painter->setPen( opt.palette.color( QPalette::Dark ) );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
to.setAlignment( Qt::AlignHCenter | Qt::AlignBottom );
|
to.setAlignment( Qt::AlignHCenter | Qt::AlignBottom );
|
||||||
text = painter->fontMetrics().elidedText( item->album()->artist()->name(), Qt::ElideRight, textRect.width() - 3 );
|
text = painter->fontMetrics().elidedText( item->album()->artist()->name(), Qt::ElideRight, textRect.width() - 3 );
|
||||||
painter->drawText( textRect, text, to );
|
painter->drawText( textRect, text, to );
|
||||||
@@ -177,9 +183,11 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AlbumItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
|
AlbumItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( model );
|
||||||
Q_UNUSED( option );
|
Q_UNUSED( option );
|
||||||
|
|
||||||
if ( event->type() != QEvent::MouseButtonRelease &&
|
if ( event->type() != QEvent::MouseButtonRelease &&
|
||||||
@@ -217,7 +225,8 @@ AlbumItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const
|
|||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
return true;
|
return true;
|
||||||
} else if ( event->type() == QEvent::MouseButtonPress )
|
}
|
||||||
|
else if ( event->type() == QEvent::MouseButtonPress )
|
||||||
{
|
{
|
||||||
// Stop the whole album from having a down click action as we just want the artist name to be clicked
|
// Stop the whole album from having a down click action as we just want the artist name to be clicked
|
||||||
event->accept();
|
event->accept();
|
||||||
@@ -231,6 +240,7 @@ AlbumItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AlbumItemDelegate::whitespaceMouseEvent()
|
AlbumItemDelegate::whitespaceMouseEvent()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user