From 9ca97d2e1a36db53538ac316bd3e9f254b0f78bd Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 13 Aug 2011 14:57:03 -0400 Subject: [PATCH] Paint proper text color in tree item delegate --- src/libtomahawk/playlist/treeitemdelegate.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/playlist/treeitemdelegate.cpp b/src/libtomahawk/playlist/treeitemdelegate.cpp index 35492e5af..f16845a8c 100644 --- a/src/libtomahawk/playlist/treeitemdelegate.cpp +++ b/src/libtomahawk/playlist/treeitemdelegate.cpp @@ -80,10 +80,16 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, QStyleOptionViewItemV4 o( *vioption ); o.palette.setColor( QPalette::Text, textColor ); + if ( o.state & QStyle::State_Selected && o.state & QStyle::State_Active ) + { + o.palette.setColor( QPalette::Text, o.palette.color( QPalette::HighlightedText ) ); + } + if ( item->isPlaying() ) { o.palette.setColor( QPalette::Highlight, o.palette.color( QPalette::Mid ) ); - o.palette.setColor( QPalette::Text, o.palette.color( QPalette::HighlightedText ) ); + if ( o.state & QStyle::State_Selected ) + o.palette.setColor( QPalette::Text, textColor ); o.state |= QStyle::State_Selected; } @@ -100,6 +106,7 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, r.adjust( 25, 0, 0, 3 ); } + painter->setPen( o.palette.text().color() ); QTextOption to( Qt::AlignVCenter );