]> git.sesse.net Git - vlc/commitdiff
Qt4 - SoundSlider. Enable MouseTracking and show a tooltip with the volume that it...
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 7 Feb 2008 08:22:24 +0000 (08:22 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 7 Feb 2008 08:22:24 +0000 (08:22 +0000)
modules/gui/qt4/util/input_slider.cpp

index 260d62d71098bc741f2f60393c862e504aa69122..8caa18ee5cdc4168fedc70c61deec8b427345f01 100644 (file)
@@ -121,6 +121,7 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard )
 
     f_step = ( _i_step * 100 ) / AOUT_VOLUME_MAX ;
     setRange( SOUNDMIN, b_hard ? (2 * SOUNDMAX) : SOUNDMAX  );
+    setMouseTracking( true );
 
     pixOutside = QPixmap( ":/pixmaps/volume-slider-outside.png" );
 
@@ -200,7 +201,11 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
         }
     }
     else
-        event->ignore();
+    {
+        setToolTip( QString("%1  \%" )
+                .arg( (int)( event->x() - paddingL ) * maximum() / WLENGTH ) );
+    }
+
 }
 
 void SoundSlider::changeValue( int x )