Commit 244afdee authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

modules/gui/qt4: Display time in seek bar when mouse-over. (Patch by Antoine...

modules/gui/qt4: Display time in seek bar when mouse-over. (Patch by Antoine Lejeune. Reviewed by jb.)
parent 73830e3b
...@@ -34,6 +34,7 @@ InputSlider::InputSlider( Qt::Orientation q,QWidget *_parent ) : ...@@ -34,6 +34,7 @@ InputSlider::InputSlider( Qt::Orientation q,QWidget *_parent ) :
{ {
mymove = false; mymove = false;
setMinimum( 0 ); setMinimum( 0 );
setMouseTracking(true);
setMaximum( 1000 ); setMaximum( 1000 );
setSingleStep( 2 ); setSingleStep( 2 );
setPageStep( 10 ); setPageStep( 10 );
...@@ -50,6 +51,7 @@ void InputSlider::setPosition( float pos, int a, int b ) ...@@ -50,6 +51,7 @@ void InputSlider::setPosition( float pos, int a, int b )
mymove = true; mymove = true;
setValue( (int)(pos * 1000.0 ) ); setValue( (int)(pos * 1000.0 ) );
mymove = false; mymove = false;
inputLength = b;
} }
void InputSlider::userDrag( int new_value ) void InputSlider::userDrag( int new_value )
...@@ -60,3 +62,11 @@ void InputSlider::userDrag( int new_value ) ...@@ -60,3 +62,11 @@ void InputSlider::userDrag( int new_value )
emit sliderDragged( f_pos ); 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 );
}
...@@ -33,8 +33,11 @@ public: ...@@ -33,8 +33,11 @@ public:
InputSlider( QWidget *_parent ); InputSlider( QWidget *_parent );
InputSlider( Qt::Orientation q,QWidget *_parent ); InputSlider( Qt::Orientation q,QWidget *_parent );
virtual ~InputSlider() {}; virtual ~InputSlider() {};
protected:
void mouseMoveEvent(QMouseEvent *event);
private: private:
bool mymove; bool mymove;
int inputLength;
public slots: public slots:
void setPosition( float, int, int ); void setPosition( float, int, int );
private slots: private slots:
......
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