From 165e1cf8b564f05725c2ec36acefc2f6551f0535 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 20 Jan 2013 06:21:59 +0100 Subject: [PATCH] * Always set the correct foreground / background colors for QueryLabel. --- src/libtomahawk/widgets/QueryLabel.cpp | 40 ++++++-------------------- src/libtomahawk/widgets/QueryLabel.h | 6 ---- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/libtomahawk/widgets/QueryLabel.cpp b/src/libtomahawk/widgets/QueryLabel.cpp index efa6cede4..5ee58cea5 100644 --- a/src/libtomahawk/widgets/QueryLabel.cpp +++ b/src/libtomahawk/widgets/QueryLabel.cpp @@ -88,7 +88,6 @@ QueryLabel::init() setContentsMargins( 0, 0, 0, 0 ); setMouseTracking( true ); - m_useCustomPen = false; m_align = Qt::AlignLeft | Qt::AlignVCenter; m_mode = Qt::ElideMiddle; @@ -282,21 +281,6 @@ QueryLabel::setAlignment( Qt::Alignment alignment ) } -void -QueryLabel::setTextPen( const QPen & pen ) -{ - m_useCustomPen = true; - m_textPen = pen; -} - - -QPen -QueryLabel::textPen() const -{ - return m_textPen; -} - - Qt::TextElideMode QueryLabel::elideMode() const { @@ -412,19 +396,15 @@ QueryLabel::paintEvent( QPaintEvent* event ) int albumX = m_type & Album ? fm.width( album()->name() ) : 0; int trackX = m_type & Track ? fm.width( track() ) : 0; - if ( m_useCustomPen ) - p.setPen( m_textPen ); - if ( m_type & Artist ) { p.setBrush( palette().window() ); - if ( !m_useCustomPen ) - p.setPen( palette().color( foregroundRole() ) ); + p.setPen( palette().color( foregroundRole() ) ); if ( m_hoverType == Artist ) { - p.setPen( palette().highlightedText().color() ); - p.setBrush( palette().highlight() ); + p.setBrush( TomahawkUtils::Colors::SELECTION_BACKGROUND ); + p.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND ); } p.drawText( r, m_align, artist()->name() ); @@ -433,8 +413,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) if ( m_type & Album && !album()->name().isEmpty() ) { p.setBrush( palette().window() ); - if ( !m_useCustomPen ) - p.setPen( palette().color( foregroundRole() ) ); + p.setPen( palette().color( foregroundRole() ) ); if ( m_type & Artist ) { @@ -443,8 +422,8 @@ QueryLabel::paintEvent( QPaintEvent* event ) } if ( m_hoverType == Album ) { - p.setPen( palette().highlightedText().color() ); - p.setBrush( palette().highlight() ); + p.setBrush( TomahawkUtils::Colors::SELECTION_BACKGROUND ); + p.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND ); } p.drawText( r, m_align, album()->name() ); @@ -453,8 +432,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) if ( m_type & Track ) { p.setBrush( palette().window() ); - if ( !m_useCustomPen ) - p.setPen( palette().color( foregroundRole() ) ); + p.setPen( palette().color( foregroundRole() ) ); if ( m_type & Artist || ( m_type & Album && !album()->name().isEmpty() ) ) { @@ -463,8 +441,8 @@ QueryLabel::paintEvent( QPaintEvent* event ) } if ( m_hoverType == Track ) { - p.setPen( palette().highlightedText().color() ); - p.setBrush( palette().highlight() ); + p.setBrush( TomahawkUtils::Colors::SELECTION_BACKGROUND ); + p.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND ); } p.drawText( r, m_align, track() ); diff --git a/src/libtomahawk/widgets/QueryLabel.h b/src/libtomahawk/widgets/QueryLabel.h index 53c3521c4..d2901a2f5 100644 --- a/src/libtomahawk/widgets/QueryLabel.h +++ b/src/libtomahawk/widgets/QueryLabel.h @@ -74,9 +74,6 @@ public: Qt::TextElideMode elideMode() const; void setElideMode( Qt::TextElideMode mode ); - void setTextPen( const QPen& ); - QPen textPen() const; - void setExtraContentsMargins( int left, int top, int right, int bottom ); void setJumpLinkVisible( bool visible ); @@ -136,9 +133,6 @@ private: Qt::Alignment m_align; Qt::TextElideMode m_mode; - bool m_useCustomPen; - QPen m_textPen; - DisplayType m_hoverType; QRect m_hoverArea; QPoint m_dragPos;