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

This commit is contained in:
Pierre d'Herbemont 2007-11-20 21:03:43 +00:00
parent 73830e3b9e
commit 244afdee57
2 changed files with 13 additions and 0 deletions

View 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 );
}

View 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: