]> git.sesse.net Git - vlc/commitdiff
Qt4: fix a value error in the seek slider
authorLudovic Fauvet <etix@l0cal.com>
Sat, 16 Apr 2011 00:56:18 +0000 (02:56 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 16 Apr 2011 12:10:17 +0000 (14:10 +0200)
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: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/util/input_slider.cpp

index 0028180c31e621cb09a0486862bc1189d714eb08..319b3718d904f37ea5d93e569b1cd13ffbb38739 100644 (file)
@@ -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