[vlc-commits] Qt4: fix a value error in the seek slider
Ludovic Fauvet
git at videolan.org
Sat Apr 16 14:23:18 CEST 2011
vlc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Sat Apr 16 02:56:18 2011 +0200| [c1f0dae2cb82aba40ae6e69a38780d8d437dd61b] | committer: 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: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1f0dae2cb82aba40ae6e69a38780d8d437dd61b
---
modules/gui/qt4/util/input_slider.cpp | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 0028180..319b371 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -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
More information about the vlc-commits
mailing list