diff --git a/src/libtomahawk/widgets/QueryLabel.cpp b/src/libtomahawk/widgets/QueryLabel.cpp index 800566a67..a4fb1e564 100644 --- a/src/libtomahawk/widgets/QueryLabel.cpp +++ b/src/libtomahawk/widgets/QueryLabel.cpp @@ -365,36 +365,6 @@ QueryLabel::minimumSizeHint() const } -void -QueryLabel::drawFancyText( QPainter* painter, const QRect& rect, const QString& text ) -{ - if ( m_align & Qt::AlignLeft ) - { - painter->save(); - - QFont fnt = painter->font(); - fnt.setStyleStrategy( QFont::ForceOutline ); - QFontMetrics fm( fnt ); - - QPainterPath textPath; - textPath.addText( rect.topLeft() + QPoint( 0, fm.ascent() ), fnt, text ); - - QLinearGradient gradient( 0, 0, 0, 1 ); - gradient.setCoordinateMode( QGradient::ObjectBoundingMode ); - gradient.setColorAt( 0, painter->pen().color() ); - gradient.setColorAt( 1, painter->pen().color().lighter() ); - painter->setPen( QPen( gradient, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ) ); - - painter->setBrush( gradient ); - painter->drawPath( textPath ); - - painter->restore(); - } - else - painter->drawText( rect, m_align, text ); -} - - void QueryLabel::paintEvent( QPaintEvent* event ) { @@ -407,7 +377,6 @@ QueryLabel::paintEvent( QPaintEvent* event ) p.save(); p.setRenderHint( QPainter::Antialiasing ); - p.setRenderHint( QPainter::TextAntialiasing ); if ( m_hoverArea.width() ) { @@ -433,8 +402,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) p.setBrush( palette().window() ); p.setPen( palette().color( foregroundRole() ) ); } - - drawFancyText( &p, r, elidedText ); + p.drawText( r, m_align, elidedText ); } else { @@ -458,7 +426,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) p.setBrush( palette().highlight() ); } - drawFancyText( &p, r, artist()->name() ); + p.drawText( r, m_align, artist()->name() ); r.adjust( artistX, 0, 0, 0 ); } if ( m_type & Album ) @@ -469,7 +437,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) if ( m_type & Artist ) { - drawFancyText( &p, r, DASH ); + p.drawText( r, m_align, DASH ); r.adjust( dashX, 0, 0, 0 ); } if ( m_hoverType == Album ) @@ -478,7 +446,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) p.setBrush( palette().highlight() ); } - drawFancyText( &p, r, album()->name() ); + p.drawText( r, m_align, album()->name() ); r.adjust( albumX, 0, 0, 0 ); } if ( m_type & Track ) @@ -489,7 +457,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) if ( m_type & Artist || m_type & Album ) { - drawFancyText( &p, r, DASH ); + p.drawText( r, m_align, DASH ); r.adjust( dashX, 0, 0, 0 ); } if ( m_hoverType == Track ) @@ -498,7 +466,7 @@ QueryLabel::paintEvent( QPaintEvent* event ) p.setBrush( palette().highlight() ); } - drawFancyText( &p, r, track() ); + p.drawText( r, m_align, track() ); r.adjust( trackX, 0, 0, 0 ); } diff --git a/src/libtomahawk/widgets/QueryLabel.h b/src/libtomahawk/widgets/QueryLabel.h index dcf3366c4..53c3521c4 100644 --- a/src/libtomahawk/widgets/QueryLabel.h +++ b/src/libtomahawk/widgets/QueryLabel.h @@ -104,8 +104,6 @@ signals: void queryChanged( const Tomahawk::query_ptr& query ); protected: - void drawFancyText( QPainter* painter, const QRect& rect, const QString& text ); - virtual void contextMenuEvent( QContextMenuEvent* event ); virtual void mousePressEvent( QMouseEvent* event );