Commit c1f0dae2 authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by Jean-Baptiste Kempf

Qt4: fix a value error in the seek slider

The slider position was computed using the width of the whole
widget instead of the ajusted rectangle which caused a drawing at a
negative position.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent e50346b1
......@@ -271,20 +271,22 @@ void SeekSlider::paintEvent( QPaintEvent *event )
painter.setBrush( backgroundGradient );
painter.drawRoundedRect( barRect, barCorner, barCorner );
QRect valueRect = barRect.adjusted( 1, 1, -1, 0 );
switch ( orientation() ) {
case Qt::Horizontal:
barRect.setWidth( qMin( width(), int( sliderPos ) ) );
valueRect.setWidth( qMin( width(), int( sliderPos ) ) );
break;
case Qt::Vertical:
barRect.setHeight( qMin( height(), int( sliderPos ) ) );
barRect.moveBottom( rect().bottom() );
valueRect.setHeight( qMin( height(), int( sliderPos ) ) );
valueRect.moveBottom( rect().bottom() );
break;
}
if ( option.sliderPosition > minimum() && option.sliderPosition <= maximum() ) {
painter.setPen( Qt::NoPen );
painter.setBrush( foregroundGradient );
painter.drawRoundedRect( barRect.adjusted( 1, 1, -1, 0 ), barCorner, barCorner );
painter.drawRoundedRect( valueRect, barCorner, barCorner );
}
// draw handle
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment