diff --git a/src/libtomahawk/widgets/ScrollingLabel.cpp b/src/libtomahawk/widgets/ScrollingLabel.cpp index 33f2efd0f..8b1a2d162 100644 --- a/src/libtomahawk/widgets/ScrollingLabel.cpp +++ b/src/libtomahawk/widgets/ScrollingLabel.cpp @@ -25,13 +25,11 @@ ScrollingLabel::ScrollingLabel( QWidget* parent) : QLabel( parent ) - , m_scrollPos( 0 ) , m_isMouseOver( false ) + , m_scrollPos( 0 ) { m_staticText.setTextFormat( Qt::PlainText ); - m_leftMargin = height() / 3; - m_separator = QString::fromUtf8( " \u26AB " ); connect( &m_timer, SIGNAL( timeout() ), this, SLOT( onTimerTimeout() ) ); @@ -54,7 +52,7 @@ ScrollingLabel::updateText() m_timer.stop(); m_singleTextWidth = fontMetrics().width( text() ); - m_scrollEnabled = ( m_singleTextWidth > width() - m_leftMargin ); + m_scrollEnabled = ( m_singleTextWidth > width() - indent() ); m_scrollPos = -64; @@ -84,7 +82,7 @@ ScrollingLabel::paintEvent( QPaintEvent* ) pb.setPen( p.pen() ); pb.setFont( p.font() ); - int x = qMin( -m_scrollPos, 0 ) + m_leftMargin; + int x = qMin( -m_scrollPos, 0 ) + indent(); while ( x < width() ) { pb.drawStaticText( QPointF( x, ( height() - m_wholeTextSize.height() ) / 2 ) + QPoint( 2, 2 ), m_staticText ); @@ -110,9 +108,9 @@ ScrollingLabel::paintEvent( QPaintEvent* ) } else { - if ( m_wholeTextSize.width() > width() - 2*m_leftMargin ) + if ( m_wholeTextSize.width() > width() - indent() ) { - p.drawStaticText( QPointF( m_leftMargin, ( height() - m_wholeTextSize.height() ) / 2 ), + p.drawStaticText( QPointF( indent(), ( height() - m_wholeTextSize.height() ) / 2 ), m_staticText ); } else @@ -166,7 +164,7 @@ ScrollingLabel::resizeEvent( QResizeEvent* ) //Update scrolling state - bool newScrollEnabled = ( m_singleTextWidth > width() - m_leftMargin ); + bool newScrollEnabled = ( m_singleTextWidth > width() - indent() ); if( newScrollEnabled != m_scrollEnabled ) updateText(); } diff --git a/src/libtomahawk/widgets/ScrollingLabel.h b/src/libtomahawk/widgets/ScrollingLabel.h index d9cdedda4..ef73c9f06 100644 --- a/src/libtomahawk/widgets/ScrollingLabel.h +++ b/src/libtomahawk/widgets/ScrollingLabel.h @@ -48,7 +48,6 @@ private: QStaticText m_staticText; int m_singleTextWidth; QSize m_wholeTextSize; - int m_leftMargin; bool m_scrollEnabled; int m_scrollPos; QImage m_alphaChannel;