mirror of https://code.videolan.org/videolan/vlc
modules/gui/qt4: Display time in seek bar when mouse-over. (Patch by Antoine Lejeune. Reviewed by jb.)
This commit is contained in:
parent
73830e3b9e
commit
244afdee57
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue