]> git.sesse.net Git - vlc/commitdiff
modules/gui/qt4: Display time in seek bar when mouse-over. (Patch by Antoine Lejeune...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 20 Nov 2007 21:03:43 +0000 (21:03 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 20 Nov 2007 21:03:43 +0000 (21:03 +0000)
modules/gui/qt4/util/input_slider.cpp
modules/gui/qt4/util/input_slider.hpp

index f48474b9cf5b0409fecbdcdb08487cbaebb9c3a9..c71770f62da1824c15d4409f8d5304bd5b3826f0 100644 (file)
@@ -34,6 +34,7 @@ InputSlider::InputSlider( Qt::Orientation q,QWidget *_parent ) :
 {
     mymove = false;
     setMinimum( 0 );
+    setMouseTracking(true);
     setMaximum( 1000 );
     setSingleStep( 2 );
     setPageStep( 10 );
@@ -50,6 +51,7 @@ void InputSlider::setPosition( float pos, int a, int b )
     mymove = true;
     setValue( (int)(pos * 1000.0 ) );
     mymove = false;
+    inputLength = b;
 }
 
 void InputSlider::userDrag( int new_value )
@@ -60,3 +62,11 @@ void InputSlider::userDrag( int new_value )
         emit sliderDragged( f_pos );
     }
 }
+
+void InputSlider::mouseMoveEvent(QMouseEvent *event)
+{
+    char psz_length[MSTRTIME_MAX_SIZE];
+    secstotimestr( psz_length,  (int)((float)event->x()/size().width()*inputLength) );
+    setToolTip( psz_length );
+}
+
index affaae6b582dcd9699993d4c4448b686dc907367..30ab21e8638f698f462a24f5bcd90a6033ad56dd 100644 (file)
@@ -33,8 +33,11 @@ public:
     InputSlider( QWidget *_parent );
     InputSlider( Qt::Orientation q,QWidget *_parent );
     virtual ~InputSlider()   {};
+protected:
+    void mouseMoveEvent(QMouseEvent *event);
 private:
     bool mymove;
+    int inputLength;
 public slots:
     void setPosition( float, int, int );
 private slots: